@@ -22,6 +22,7 @@ export interface AugmentedNode extends ts.Node {
22
22
$symbol ?: number ;
23
23
$resolvedSignature ?: number ;
24
24
$overloadIndex ?: number ;
25
+ $declaredSignature ?: number ;
25
26
}
26
27
27
28
export type AugmentedPos = number ;
@@ -263,6 +264,17 @@ export function augmentAst(ast: AugmentedSourceFile, code: string, project: Proj
263
264
namePart . $symbol = typeTable . getSymbolId ( symbol ) ;
264
265
}
265
266
}
267
+ if ( ts . isFunctionLike ( node ) ) {
268
+ let signature = typeChecker . getSignatureFromDeclaration ( node ) ;
269
+ if ( signature != null ) {
270
+ let kind = ts . isConstructSignatureDeclaration ( node ) || ts . isConstructorDeclaration ( node )
271
+ ? ts . SignatureKind . Construct : ts . SignatureKind . Call ;
272
+ let id = typeTable . getSignatureId ( kind , signature ) ;
273
+ if ( id != null ) {
274
+ ( node as AugmentedNode ) . $declaredSignature = id ;
275
+ }
276
+ }
277
+ }
266
278
}
267
279
}
268
280
}
@@ -295,54 +307,61 @@ function isNamedNodeWithSymbol(node: ts.Node): node is NamedNodeWithSymbol {
295
307
*/
296
308
function isTypedNode ( node : ts . Node ) : boolean {
297
309
switch ( node . kind ) {
298
- case ts . SyntaxKind . ArrayLiteralExpression :
299
- case ts . SyntaxKind . ArrowFunction :
300
- case ts . SyntaxKind . AsExpression :
301
- case ts . SyntaxKind . AwaitExpression :
302
- case ts . SyntaxKind . BinaryExpression :
303
- case ts . SyntaxKind . CallExpression :
304
- case ts . SyntaxKind . ClassExpression :
305
- case ts . SyntaxKind . CommaListExpression :
306
- case ts . SyntaxKind . ConditionalExpression :
307
- case ts . SyntaxKind . DeleteExpression :
308
- case ts . SyntaxKind . ElementAccessExpression :
309
- case ts . SyntaxKind . ExpressionStatement :
310
- case ts . SyntaxKind . ExpressionWithTypeArguments :
311
- case ts . SyntaxKind . FalseKeyword :
312
- case ts . SyntaxKind . FunctionDeclaration :
313
- case ts . SyntaxKind . FunctionExpression :
314
- case ts . SyntaxKind . Identifier :
315
- case ts . SyntaxKind . JsxExpression :
316
- case ts . SyntaxKind . LiteralType :
317
- case ts . SyntaxKind . NewExpression :
318
- case ts . SyntaxKind . NonNullExpression :
319
- case ts . SyntaxKind . NoSubstitutionTemplateLiteral :
320
- case ts . SyntaxKind . NumericLiteral :
321
- case ts . SyntaxKind . ObjectKeyword :
322
- case ts . SyntaxKind . ObjectLiteralExpression :
323
- case ts . SyntaxKind . OmittedExpression :
324
- case ts . SyntaxKind . ParenthesizedExpression :
325
- case ts . SyntaxKind . PartiallyEmittedExpression :
326
- case ts . SyntaxKind . PostfixUnaryExpression :
327
- case ts . SyntaxKind . PrefixUnaryExpression :
328
- case ts . SyntaxKind . PropertyAccessExpression :
329
- case ts . SyntaxKind . RegularExpressionLiteral :
330
- case ts . SyntaxKind . StringLiteral :
331
- case ts . SyntaxKind . TaggedTemplateExpression :
332
- case ts . SyntaxKind . TemplateExpression :
333
- case ts . SyntaxKind . TemplateHead :
334
- case ts . SyntaxKind . TemplateMiddle :
335
- case ts . SyntaxKind . TemplateSpan :
336
- case ts . SyntaxKind . TemplateTail :
337
- case ts . SyntaxKind . TrueKeyword :
338
- case ts . SyntaxKind . TypeAssertionExpression :
339
- case ts . SyntaxKind . TypeLiteral :
340
- case ts . SyntaxKind . TypeOfExpression :
341
- case ts . SyntaxKind . VoidExpression :
342
- case ts . SyntaxKind . YieldExpression :
343
- return true ;
344
- default :
345
- return ts . isTypeNode ( node ) ;
310
+ case ts . SyntaxKind . ArrayLiteralExpression :
311
+ case ts . SyntaxKind . ArrowFunction :
312
+ case ts . SyntaxKind . AsExpression :
313
+ case ts . SyntaxKind . AwaitExpression :
314
+ case ts . SyntaxKind . BinaryExpression :
315
+ case ts . SyntaxKind . CallExpression :
316
+ case ts . SyntaxKind . ClassExpression :
317
+ case ts . SyntaxKind . ClassDeclaration :
318
+ case ts . SyntaxKind . CommaListExpression :
319
+ case ts . SyntaxKind . ConditionalExpression :
320
+ case ts . SyntaxKind . Constructor :
321
+ case ts . SyntaxKind . DeleteExpression :
322
+ case ts . SyntaxKind . ElementAccessExpression :
323
+ case ts . SyntaxKind . ExpressionStatement :
324
+ case ts . SyntaxKind . ExpressionWithTypeArguments :
325
+ case ts . SyntaxKind . FalseKeyword :
326
+ case ts . SyntaxKind . FunctionDeclaration :
327
+ case ts . SyntaxKind . FunctionExpression :
328
+ case ts . SyntaxKind . GetAccessor :
329
+ case ts . SyntaxKind . Identifier :
330
+ case ts . SyntaxKind . IndexSignature :
331
+ case ts . SyntaxKind . JsxExpression :
332
+ case ts . SyntaxKind . LiteralType :
333
+ case ts . SyntaxKind . MethodDeclaration :
334
+ case ts . SyntaxKind . MethodSignature :
335
+ case ts . SyntaxKind . NewExpression :
336
+ case ts . SyntaxKind . NonNullExpression :
337
+ case ts . SyntaxKind . NoSubstitutionTemplateLiteral :
338
+ case ts . SyntaxKind . NumericLiteral :
339
+ case ts . SyntaxKind . ObjectKeyword :
340
+ case ts . SyntaxKind . ObjectLiteralExpression :
341
+ case ts . SyntaxKind . OmittedExpression :
342
+ case ts . SyntaxKind . ParenthesizedExpression :
343
+ case ts . SyntaxKind . PartiallyEmittedExpression :
344
+ case ts . SyntaxKind . PostfixUnaryExpression :
345
+ case ts . SyntaxKind . PrefixUnaryExpression :
346
+ case ts . SyntaxKind . PropertyAccessExpression :
347
+ case ts . SyntaxKind . RegularExpressionLiteral :
348
+ case ts . SyntaxKind . SetAccessor :
349
+ case ts . SyntaxKind . StringLiteral :
350
+ case ts . SyntaxKind . TaggedTemplateExpression :
351
+ case ts . SyntaxKind . TemplateExpression :
352
+ case ts . SyntaxKind . TemplateHead :
353
+ case ts . SyntaxKind . TemplateMiddle :
354
+ case ts . SyntaxKind . TemplateSpan :
355
+ case ts . SyntaxKind . TemplateTail :
356
+ case ts . SyntaxKind . TrueKeyword :
357
+ case ts . SyntaxKind . TypeAssertionExpression :
358
+ case ts . SyntaxKind . TypeLiteral :
359
+ case ts . SyntaxKind . TypeOfExpression :
360
+ case ts . SyntaxKind . VoidExpression :
361
+ case ts . SyntaxKind . YieldExpression :
362
+ return true ;
363
+ default :
364
+ return ts . isTypeNode ( node ) ;
346
365
}
347
366
}
348
367
0 commit comments