@@ -118,7 +118,7 @@ namespace ts {
118
118
let thisParentContainer : Node ; // Container one level up
119
119
let blockScopeContainer : Node ;
120
120
let lastContainer : Node ;
121
- let delayedTypedefs : { typedef : JSDocTypedefTag , container : Node , lastContainer : Node , blockScopeContainer : Node , parent : Node } [ ] ;
121
+ let delayedTypedefs : { typeAlias : JSDocTypedefTag | JSDocCallbackTag , container : Node , lastContainer : Node , blockScopeContainer : Node , parent : Node } [ ] ;
122
122
let seenThisKeyword : boolean ;
123
123
124
124
// state used by control flow analysis
@@ -273,6 +273,7 @@ namespace ts {
273
273
return InternalSymbolName . Constructor ;
274
274
case SyntaxKind . FunctionType :
275
275
case SyntaxKind . CallSignature :
276
+ case SyntaxKind . JSDocSignature :
276
277
return InternalSymbolName . Call ;
277
278
case SyntaxKind . ConstructorType :
278
279
case SyntaxKind . ConstructSignature :
@@ -1452,6 +1453,7 @@ namespace ts {
1452
1453
case SyntaxKind . GetAccessor :
1453
1454
case SyntaxKind . SetAccessor :
1454
1455
case SyntaxKind . CallSignature :
1456
+ case SyntaxKind . JSDocSignature :
1455
1457
case SyntaxKind . JSDocFunctionType :
1456
1458
case SyntaxKind . FunctionType :
1457
1459
case SyntaxKind . ConstructSignature :
@@ -1541,6 +1543,7 @@ namespace ts {
1541
1543
case SyntaxKind . ConstructorType :
1542
1544
case SyntaxKind . CallSignature :
1543
1545
case SyntaxKind . ConstructSignature :
1546
+ case SyntaxKind . JSDocSignature :
1544
1547
case SyntaxKind . IndexSignature :
1545
1548
case SyntaxKind . MethodDeclaration :
1546
1549
case SyntaxKind . MethodSignature :
@@ -1646,7 +1649,7 @@ namespace ts {
1646
1649
return state ;
1647
1650
}
1648
1651
1649
- function bindFunctionOrConstructorType ( node : SignatureDeclaration ) : void {
1652
+ function bindFunctionOrConstructorType ( node : SignatureDeclaration | JSDocSignature ) : void {
1650
1653
// For a given function symbol "<...>(...) => T" we want to generate a symbol identical
1651
1654
// to the one we would get for: { <...>(...): T }
1652
1655
//
@@ -1757,7 +1760,7 @@ namespace ts {
1757
1760
const saveParent = parent ;
1758
1761
for ( const delay of delayedTypedefs ) {
1759
1762
( { container, lastContainer, blockScopeContainer, parent } = delay ) ;
1760
- bindBlockScopedDeclaration ( delay . typedef , SymbolFlags . TypeAlias , SymbolFlags . TypeAliasExcludes ) ;
1763
+ bindBlockScopedDeclaration ( delay . typeAlias , SymbolFlags . TypeAlias , SymbolFlags . TypeAliasExcludes ) ;
1761
1764
}
1762
1765
container = saveContainer ;
1763
1766
lastContainer = saveLastContainer ;
@@ -2100,6 +2103,7 @@ namespace ts {
2100
2103
case SyntaxKind . TypeParameter :
2101
2104
return bindTypeParameter ( node as TypeParameterDeclaration ) ;
2102
2105
case SyntaxKind . Parameter :
2106
+ case SyntaxKind . JSDocParameterTag :
2103
2107
return bindParameter ( < ParameterDeclaration > node ) ;
2104
2108
case SyntaxKind . VariableDeclaration :
2105
2109
return bindVariableDeclarationOrBindingElement ( < VariableDeclaration > node ) ;
@@ -2137,8 +2141,9 @@ namespace ts {
2137
2141
return bindPropertyOrMethodOrAccessor ( < Declaration > node , SymbolFlags . SetAccessor , SymbolFlags . SetAccessorExcludes ) ;
2138
2142
case SyntaxKind . FunctionType :
2139
2143
case SyntaxKind . JSDocFunctionType :
2144
+ case SyntaxKind . JSDocSignature :
2140
2145
case SyntaxKind . ConstructorType :
2141
- return bindFunctionOrConstructorType ( < SignatureDeclaration > node ) ;
2146
+ return bindFunctionOrConstructorType ( < SignatureDeclaration | JSDocSignature > node ) ;
2142
2147
case SyntaxKind . TypeLiteral :
2143
2148
case SyntaxKind . JSDocTypeLiteral :
2144
2149
case SyntaxKind . MappedType :
@@ -2211,10 +2216,11 @@ namespace ts {
2211
2216
SymbolFlags . Property | SymbolFlags . Optional :
2212
2217
SymbolFlags . Property ;
2213
2218
return declareSymbolAndAddToSymbolTable ( propTag , flags , SymbolFlags . PropertyExcludes ) ;
2214
- case SyntaxKind . JSDocTypedefTag : {
2219
+ case SyntaxKind . JSDocTypedefTag :
2220
+ case SyntaxKind . JSDocCallbackTag : {
2215
2221
const { fullName } = node as JSDocTypedefTag ;
2216
2222
if ( ! fullName || fullName . kind === SyntaxKind . Identifier ) {
2217
- ( delayedTypedefs || ( delayedTypedefs = [ ] ) ) . push ( { typedef : node as JSDocTypedefTag , container, lastContainer, blockScopeContainer, parent } ) ;
2223
+ ( delayedTypedefs || ( delayedTypedefs = [ ] ) ) . push ( { typeAlias : node as JSDocTypedefTag | JSDocCallbackTag , container, lastContainer, blockScopeContainer, parent } ) ;
2218
2224
}
2219
2225
break ;
2220
2226
}
@@ -2611,15 +2617,15 @@ namespace ts {
2611
2617
}
2612
2618
}
2613
2619
2614
- function bindParameter ( node : ParameterDeclaration ) {
2620
+ function bindParameter ( node : ParameterDeclaration | JSDocParameterTag ) {
2615
2621
if ( inStrictMode && ! ( node . flags & NodeFlags . Ambient ) ) {
2616
2622
// It is a SyntaxError if the identifier eval or arguments appears within a FormalParameterList of a
2617
2623
// strict mode FunctionLikeDeclaration or FunctionExpression(13.1)
2618
2624
checkStrictModeEvalOrArguments ( node , node . name ) ;
2619
2625
}
2620
2626
2621
2627
if ( isBindingPattern ( node . name ) ) {
2622
- bindAnonymousDeclaration ( node , SymbolFlags . FunctionScopedVariable , "__" + node . parent . parameters . indexOf ( node ) as __String ) ;
2628
+ bindAnonymousDeclaration ( node , SymbolFlags . FunctionScopedVariable , "__" + ( node as ParameterDeclaration ) . parent . parameters . indexOf ( node as ParameterDeclaration ) as __String ) ;
2623
2629
}
2624
2630
else {
2625
2631
declareSymbolAndAddToSymbolTable ( node , SymbolFlags . FunctionScopedVariable , SymbolFlags . ParameterExcludes ) ;
0 commit comments