@@ -251,6 +251,15 @@ namespace ts {
251
251
case SyntaxKind . FunctionDeclaration :
252
252
case SyntaxKind . ClassDeclaration :
253
253
return node . flags & NodeFlags . Default ? "default" : undefined ;
254
+ case SyntaxKind . JSDocFunctionType :
255
+ return isJSDocConstructSignature ( node ) ? "__new" : "__call" ;
256
+ case SyntaxKind . Parameter :
257
+ // Parameters with names are handled at the top of this function. Parameters
258
+ // without names can only come from JSDocFunctionTypes.
259
+ Debug . assert ( node . parent . kind === SyntaxKind . JSDocFunctionType ) ;
260
+ let functionType = < JSDocFunctionType > node . parent ;
261
+ let index = indexOf ( functionType . parameters , node ) ;
262
+ return "p" + index ;
254
263
}
255
264
}
256
265
@@ -421,7 +430,6 @@ namespace ts {
421
430
422
431
addToContainerChain ( container ) ;
423
432
}
424
-
425
433
else if ( containerFlags & ContainerFlags . IsBlockScopedContainer ) {
426
434
blockScopeContainer = node ;
427
435
blockScopeContainer . locals = undefined ;
@@ -459,6 +467,10 @@ namespace ts {
459
467
labelStack = labelIndexMap = implicitLabels = undefined ;
460
468
}
461
469
470
+ if ( isInJavaScriptFile ( node ) && node . jsDocComment ) {
471
+ bind ( node . jsDocComment ) ;
472
+ }
473
+
462
474
bindReachableStatement ( node ) ;
463
475
464
476
if ( currentReachabilityState === Reachability . Reachable && isFunctionLikeKind ( kind ) && nodeIsPresent ( ( < FunctionLikeDeclaration > node ) . body ) ) {
@@ -722,8 +734,9 @@ namespace ts {
722
734
case SyntaxKind . ClassDeclaration :
723
735
case SyntaxKind . InterfaceDeclaration :
724
736
case SyntaxKind . EnumDeclaration :
725
- case SyntaxKind . TypeLiteral :
726
737
case SyntaxKind . ObjectLiteralExpression :
738
+ case SyntaxKind . TypeLiteral :
739
+ case SyntaxKind . JSDocRecordType :
727
740
return ContainerFlags . IsContainer ;
728
741
729
742
case SyntaxKind . CallSignature :
@@ -809,6 +822,7 @@ namespace ts {
809
822
case SyntaxKind . TypeLiteral :
810
823
case SyntaxKind . ObjectLiteralExpression :
811
824
case SyntaxKind . InterfaceDeclaration :
825
+ case SyntaxKind . JSDocRecordType :
812
826
// Interface/Object-types always have their children added to the 'members' of
813
827
// their container. They are only accessible through an instance of their
814
828
// container, and are never in scope otherwise (even inside the body of the
@@ -829,6 +843,7 @@ namespace ts {
829
843
case SyntaxKind . FunctionDeclaration :
830
844
case SyntaxKind . FunctionExpression :
831
845
case SyntaxKind . ArrowFunction :
846
+ case SyntaxKind . JSDocFunctionType :
832
847
case SyntaxKind . TypeAliasDeclaration :
833
848
// All the children of these container types are never visible through another
834
849
// symbol (i.e. through another symbol's 'exports' or 'members'). Instead,
@@ -910,7 +925,7 @@ namespace ts {
910
925
}
911
926
}
912
927
913
- function bindFunctionOrConstructorType ( node : SignatureDeclaration ) {
928
+ function bindFunctionOrConstructorType ( node : SignatureDeclaration ) : void {
914
929
// For a given function symbol "<...>(...) => T" we want to generate a symbol identical
915
930
// to the one we would get for: { <...>(...): T }
916
931
//
@@ -985,7 +1000,7 @@ namespace ts {
985
1000
declareModuleMember ( node , symbolFlags , symbolExcludes ) ;
986
1001
break ;
987
1002
}
988
- // fall through.
1003
+ // fall through.
989
1004
default :
990
1005
if ( ! blockScopeContainer . locals ) {
991
1006
blockScopeContainer . locals = { } ;
@@ -1264,12 +1279,14 @@ namespace ts {
1264
1279
return bindVariableDeclarationOrBindingElement ( < VariableDeclaration | BindingElement > node ) ;
1265
1280
case SyntaxKind . PropertyDeclaration :
1266
1281
case SyntaxKind . PropertySignature :
1282
+ case SyntaxKind . JSDocRecordMember :
1267
1283
return bindPropertyOrMethodOrAccessor ( < Declaration > node , SymbolFlags . Property | ( ( < PropertyDeclaration > node ) . questionToken ? SymbolFlags . Optional : SymbolFlags . None ) , SymbolFlags . PropertyExcludes ) ;
1268
1284
case SyntaxKind . PropertyAssignment :
1269
1285
case SyntaxKind . ShorthandPropertyAssignment :
1270
1286
return bindPropertyOrMethodOrAccessor ( < Declaration > node , SymbolFlags . Property , SymbolFlags . PropertyExcludes ) ;
1271
1287
case SyntaxKind . EnumMember :
1272
1288
return bindPropertyOrMethodOrAccessor ( < Declaration > node , SymbolFlags . EnumMember , SymbolFlags . EnumMemberExcludes ) ;
1289
+
1273
1290
case SyntaxKind . CallSignature :
1274
1291
case SyntaxKind . ConstructSignature :
1275
1292
case SyntaxKind . IndexSignature :
@@ -1292,8 +1309,10 @@ namespace ts {
1292
1309
return bindPropertyOrMethodOrAccessor ( < Declaration > node , SymbolFlags . SetAccessor , SymbolFlags . SetAccessorExcludes ) ;
1293
1310
case SyntaxKind . FunctionType :
1294
1311
case SyntaxKind . ConstructorType :
1312
+ case SyntaxKind . JSDocFunctionType :
1295
1313
return bindFunctionOrConstructorType ( < SignatureDeclaration > node ) ;
1296
1314
case SyntaxKind . TypeLiteral :
1315
+ case SyntaxKind . JSDocRecordType :
1297
1316
return bindAnonymousDeclaration ( < TypeLiteralNode > node , SymbolFlags . TypeLiteral , "__type" ) ;
1298
1317
case SyntaxKind . ObjectLiteralExpression :
1299
1318
return bindObjectLiteralExpression ( < ObjectLiteralExpression > node ) ;
0 commit comments