@@ -1157,7 +1157,7 @@ namespace ts {
1157
1157
}
1158
1158
1159
1159
function parseAnyContextualModifier ( ) : boolean {
1160
- return isModifier ( token ) && tryParse ( nextTokenCanFollowModifier ) ;
1160
+ return isModifierKind ( token ) && tryParse ( nextTokenCanFollowModifier ) ;
1161
1161
}
1162
1162
1163
1163
function canFollowModifier ( ) : boolean {
@@ -2004,7 +2004,7 @@ namespace ts {
2004
2004
}
2005
2005
2006
2006
function isStartOfParameter ( ) : boolean {
2007
- return token === SyntaxKind . DotDotDotToken || isIdentifierOrPattern ( ) || isModifier ( token ) || token === SyntaxKind . AtToken ;
2007
+ return token === SyntaxKind . DotDotDotToken || isIdentifierOrPattern ( ) || isModifierKind ( token ) || token === SyntaxKind . AtToken ;
2008
2008
}
2009
2009
2010
2010
function setModifiers ( node : Node , modifiers : ModifiersArray ) {
@@ -2025,7 +2025,7 @@ namespace ts {
2025
2025
2026
2026
node . name = parseIdentifierOrPattern ( ) ;
2027
2027
2028
- if ( getFullWidth ( node . name ) === 0 && node . flags === 0 && isModifier ( token ) ) {
2028
+ if ( getFullWidth ( node . name ) === 0 && node . flags === 0 && isModifierKind ( token ) ) {
2029
2029
// in cases like
2030
2030
// 'use strict'
2031
2031
// function foo(static)
@@ -2132,8 +2132,8 @@ namespace ts {
2132
2132
parseSemicolon ( ) ;
2133
2133
}
2134
2134
2135
- function parseSignatureMember ( kind : SyntaxKind ) : SignatureDeclaration {
2136
- const node = < SignatureDeclaration > createNode ( kind ) ;
2135
+ function parseSignatureMember ( kind : SyntaxKind ) : CallSignatureDeclaration | ConstructSignatureDeclaration {
2136
+ const node = < CallSignatureDeclaration | ConstructSignatureDeclaration > createNode ( kind ) ;
2137
2137
if ( kind === SyntaxKind . ConstructSignature ) {
2138
2138
parseExpected ( SyntaxKind . NewKeyword ) ;
2139
2139
}
@@ -2172,7 +2172,7 @@ namespace ts {
2172
2172
return true ;
2173
2173
}
2174
2174
2175
- if ( isModifier ( token ) ) {
2175
+ if ( isModifierKind ( token ) ) {
2176
2176
nextToken ( ) ;
2177
2177
if ( isIdentifier ( ) ) {
2178
2178
return true ;
@@ -2215,13 +2215,13 @@ namespace ts {
2215
2215
return finishNode ( node ) ;
2216
2216
}
2217
2217
2218
- function parsePropertyOrMethodSignature ( ) : Declaration {
2218
+ function parsePropertyOrMethodSignature ( ) : PropertySignature | MethodSignature {
2219
2219
const fullStart = scanner . getStartPos ( ) ;
2220
2220
const name = parsePropertyName ( ) ;
2221
2221
const questionToken = parseOptionalToken ( SyntaxKind . QuestionToken ) ;
2222
2222
2223
2223
if ( token === SyntaxKind . OpenParenToken || token === SyntaxKind . LessThanToken ) {
2224
- const method = < MethodDeclaration > createNode ( SyntaxKind . MethodSignature , fullStart ) ;
2224
+ const method = < MethodSignature > createNode ( SyntaxKind . MethodSignature , fullStart ) ;
2225
2225
method . name = name ;
2226
2226
method . questionToken = questionToken ;
2227
2227
@@ -2232,7 +2232,7 @@ namespace ts {
2232
2232
return finishNode ( method ) ;
2233
2233
}
2234
2234
else {
2235
- const property = < PropertyDeclaration > createNode ( SyntaxKind . PropertySignature , fullStart ) ;
2235
+ const property = < PropertySignature > createNode ( SyntaxKind . PropertySignature , fullStart ) ;
2236
2236
property . name = name ;
2237
2237
property . questionToken = questionToken ;
2238
2238
property . type = parseTypeAnnotation ( ) ;
@@ -2248,7 +2248,7 @@ namespace ts {
2248
2248
case SyntaxKind . OpenBracketToken : // Both for indexers and computed properties
2249
2249
return true ;
2250
2250
default :
2251
- if ( isModifier ( token ) ) {
2251
+ if ( isModifierKind ( token ) ) {
2252
2252
const result = lookAhead ( isStartOfIndexSignatureDeclaration ) ;
2253
2253
if ( result ) {
2254
2254
return result ;
@@ -2260,7 +2260,7 @@ namespace ts {
2260
2260
}
2261
2261
2262
2262
function isStartOfIndexSignatureDeclaration ( ) {
2263
- while ( isModifier ( token ) ) {
2263
+ while ( isModifierKind ( token ) ) {
2264
2264
nextToken ( ) ;
2265
2265
}
2266
2266
@@ -2276,7 +2276,7 @@ namespace ts {
2276
2276
canParseSemicolon ( ) ;
2277
2277
}
2278
2278
2279
- function parseTypeMember ( ) : Declaration {
2279
+ function parseTypeMember ( ) : TypeElement {
2280
2280
switch ( token ) {
2281
2281
case SyntaxKind . OpenParenToken :
2282
2282
case SyntaxKind . LessThanToken :
@@ -2301,7 +2301,7 @@ namespace ts {
2301
2301
// when incrementally parsing as the parser will produce the Index declaration
2302
2302
// if it has the same text regardless of whether it is inside a class or an
2303
2303
// object type.
2304
- if ( isModifier ( token ) ) {
2304
+ if ( isModifierKind ( token ) ) {
2305
2305
const result = tryParse ( parseIndexSignatureWithModifiers ) ;
2306
2306
if ( result ) {
2307
2307
return result ;
@@ -2334,14 +2334,14 @@ namespace ts {
2334
2334
return finishNode ( node ) ;
2335
2335
}
2336
2336
2337
- function parseObjectTypeMembers ( ) : NodeArray < Declaration > {
2338
- let members : NodeArray < Declaration > ;
2337
+ function parseObjectTypeMembers ( ) : NodeArray < TypeElement > {
2338
+ let members : NodeArray < TypeElement > ;
2339
2339
if ( parseExpected ( SyntaxKind . OpenBraceToken ) ) {
2340
2340
members = parseList ( ParsingContext . TypeMembers , parseTypeMember ) ;
2341
2341
parseExpected ( SyntaxKind . CloseBraceToken ) ;
2342
2342
}
2343
2343
else {
2344
- members = createMissingList < Declaration > ( ) ;
2344
+ members = createMissingList < TypeElement > ( ) ;
2345
2345
}
2346
2346
2347
2347
return members ;
@@ -2483,11 +2483,11 @@ namespace ts {
2483
2483
// ( ...
2484
2484
return true ;
2485
2485
}
2486
- if ( isIdentifier ( ) || isModifier ( token ) ) {
2486
+ if ( isIdentifier ( ) || isModifierKind ( token ) ) {
2487
2487
nextToken ( ) ;
2488
2488
if ( token === SyntaxKind . ColonToken || token === SyntaxKind . CommaToken ||
2489
2489
token === SyntaxKind . QuestionToken || token === SyntaxKind . EqualsToken ||
2490
- isIdentifier ( ) || isModifier ( token ) ) {
2490
+ isIdentifier ( ) || isModifierKind ( token ) ) {
2491
2491
// ( id :
2492
2492
// ( id ,
2493
2493
// ( id ?
@@ -2894,7 +2894,7 @@ namespace ts {
2894
2894
}
2895
2895
2896
2896
// This *could* be a parenthesized arrow function.
2897
- // Return Unknown to const the caller know.
2897
+ // Return Unknown to let the caller know.
2898
2898
return Tristate . Unknown ;
2899
2899
}
2900
2900
else {
@@ -2993,7 +2993,7 @@ namespace ts {
2993
2993
// user meant to supply a block. For example, if the user wrote:
2994
2994
//
2995
2995
// a =>
2996
- // const v = 0;
2996
+ // let v = 0;
2997
2997
// }
2998
2998
//
2999
2999
// they may be missing an open brace. Check to see if that's the case so we can
@@ -3220,7 +3220,7 @@ namespace ts {
3220
3220
3221
3221
/**
3222
3222
* Parse ES7 unary expression and await expression
3223
- *
3223
+ *
3224
3224
* ES7 UnaryExpression:
3225
3225
* 1) SimpleUnaryExpression[?yield]
3226
3226
* 2) IncrementExpression[?yield] ** UnaryExpression[?yield]
@@ -4720,7 +4720,7 @@ namespace ts {
4720
4720
return finishNode ( node ) ;
4721
4721
}
4722
4722
4723
- function parseMethodDeclaration ( fullStart : number , decorators : NodeArray < Decorator > , modifiers : ModifiersArray , asteriskToken : Node , name : DeclarationName , questionToken : Node , diagnosticMessage ?: DiagnosticMessage ) : MethodDeclaration {
4723
+ function parseMethodDeclaration ( fullStart : number , decorators : NodeArray < Decorator > , modifiers : ModifiersArray , asteriskToken : Node , name : PropertyName , questionToken : Node , diagnosticMessage ?: DiagnosticMessage ) : MethodDeclaration {
4724
4724
const method = < MethodDeclaration > createNode ( SyntaxKind . MethodDeclaration , fullStart ) ;
4725
4725
method . decorators = decorators ;
4726
4726
setModifiers ( method , modifiers ) ;
@@ -4734,7 +4734,7 @@ namespace ts {
4734
4734
return finishNode ( method ) ;
4735
4735
}
4736
4736
4737
- function parsePropertyDeclaration ( fullStart : number , decorators : NodeArray < Decorator > , modifiers : ModifiersArray , name : DeclarationName , questionToken : Node ) : ClassElement {
4737
+ function parsePropertyDeclaration ( fullStart : number , decorators : NodeArray < Decorator > , modifiers : ModifiersArray , name : PropertyName , questionToken : Node ) : ClassElement {
4738
4738
const property = < PropertyDeclaration > createNode ( SyntaxKind . PropertyDeclaration , fullStart ) ;
4739
4739
property . decorators = decorators ;
4740
4740
setModifiers ( property , modifiers ) ;
@@ -4808,7 +4808,7 @@ namespace ts {
4808
4808
}
4809
4809
4810
4810
// Eat up all modifiers, but hold on to the last one in case it is actually an identifier.
4811
- while ( isModifier ( token ) ) {
4811
+ while ( isModifierKind ( token ) ) {
4812
4812
idToken = token ;
4813
4813
// If the idToken is a class modifier (protected, private, public, and static), it is
4814
4814
// certain that we are starting to parse class member. This allows better error recovery
@@ -5018,8 +5018,8 @@ namespace ts {
5018
5018
// implements is a future reserved word so
5019
5019
// 'class implements' might mean either
5020
5020
// - class expression with omitted name, 'implements' starts heritage clause
5021
- // - class with name 'implements'
5022
- // 'isImplementsClause' helps to disambiguate between these two cases
5021
+ // - class with name 'implements'
5022
+ // 'isImplementsClause' helps to disambiguate between these two cases
5023
5023
return isIdentifier ( ) && ! isImplementsClause ( )
5024
5024
? parseIdentifier ( )
5025
5025
: undefined ;
0 commit comments