@@ -1082,7 +1082,7 @@ namespace ts {
1082
1082
token === SyntaxKind . NumericLiteral ;
1083
1083
}
1084
1084
1085
- function parsePropertyNameWorker ( allowComputedPropertyNames : boolean ) : DeclarationName {
1085
+ function parsePropertyNameWorker ( allowComputedPropertyNames : boolean ) : PropertyName {
1086
1086
if ( token === SyntaxKind . StringLiteral || token === SyntaxKind . NumericLiteral ) {
1087
1087
return parseLiteralNode ( /*internName*/ true ) ;
1088
1088
}
@@ -1092,7 +1092,7 @@ namespace ts {
1092
1092
return parseIdentifierName ( ) ;
1093
1093
}
1094
1094
1095
- function parsePropertyName ( ) : DeclarationName {
1095
+ function parsePropertyName ( ) : PropertyName {
1096
1096
return parsePropertyNameWorker ( /*allowComputedPropertyNames:*/ true ) ;
1097
1097
}
1098
1098
@@ -1152,7 +1152,7 @@ namespace ts {
1152
1152
}
1153
1153
1154
1154
function parseAnyContextualModifier ( ) : boolean {
1155
- return isModifier ( token ) && tryParse ( nextTokenCanFollowModifier ) ;
1155
+ return isModifierKind ( token ) && tryParse ( nextTokenCanFollowModifier ) ;
1156
1156
}
1157
1157
1158
1158
function canFollowModifier ( ) : boolean {
@@ -1999,7 +1999,7 @@ namespace ts {
1999
1999
}
2000
2000
2001
2001
function isStartOfParameter ( ) : boolean {
2002
- return token === SyntaxKind . DotDotDotToken || isIdentifierOrPattern ( ) || isModifier ( token ) || token === SyntaxKind . AtToken ;
2002
+ return token === SyntaxKind . DotDotDotToken || isIdentifierOrPattern ( ) || isModifierKind ( token ) || token === SyntaxKind . AtToken ;
2003
2003
}
2004
2004
2005
2005
function setModifiers ( node : Node , modifiers : ModifiersArray ) {
@@ -2020,7 +2020,7 @@ namespace ts {
2020
2020
2021
2021
node . name = parseIdentifierOrPattern ( ) ;
2022
2022
2023
- if ( getFullWidth ( node . name ) === 0 && node . flags === 0 && isModifier ( token ) ) {
2023
+ if ( getFullWidth ( node . name ) === 0 && node . flags === 0 && isModifierKind ( token ) ) {
2024
2024
// in cases like
2025
2025
// 'use strict'
2026
2026
// function foo(static)
@@ -2127,8 +2127,8 @@ namespace ts {
2127
2127
parseSemicolon ( ) ;
2128
2128
}
2129
2129
2130
- function parseSignatureMember ( kind : SyntaxKind ) : SignatureDeclaration {
2131
- const node = < SignatureDeclaration > createNode ( kind ) ;
2130
+ function parseSignatureMember ( kind : SyntaxKind ) : CallSignatureDeclaration | ConstructSignatureDeclaration {
2131
+ const node = < CallSignatureDeclaration | ConstructSignatureDeclaration > createNode ( kind ) ;
2132
2132
if ( kind === SyntaxKind . ConstructSignature ) {
2133
2133
parseExpected ( SyntaxKind . NewKeyword ) ;
2134
2134
}
@@ -2167,7 +2167,7 @@ namespace ts {
2167
2167
return true ;
2168
2168
}
2169
2169
2170
- if ( isModifier ( token ) ) {
2170
+ if ( isModifierKind ( token ) ) {
2171
2171
nextToken ( ) ;
2172
2172
if ( isIdentifier ( ) ) {
2173
2173
return true ;
@@ -2210,13 +2210,13 @@ namespace ts {
2210
2210
return finishNode ( node ) ;
2211
2211
}
2212
2212
2213
- function parsePropertyOrMethodSignature ( ) : Declaration {
2213
+ function parsePropertyOrMethodSignature ( ) : PropertySignature | MethodSignature {
2214
2214
const fullStart = scanner . getStartPos ( ) ;
2215
2215
const name = parsePropertyName ( ) ;
2216
2216
const questionToken = parseOptionalToken ( SyntaxKind . QuestionToken ) ;
2217
2217
2218
2218
if ( token === SyntaxKind . OpenParenToken || token === SyntaxKind . LessThanToken ) {
2219
- const method = < MethodDeclaration > createNode ( SyntaxKind . MethodSignature , fullStart ) ;
2219
+ const method = < MethodSignature > createNode ( SyntaxKind . MethodSignature , fullStart ) ;
2220
2220
method . name = name ;
2221
2221
method . questionToken = questionToken ;
2222
2222
@@ -2227,7 +2227,7 @@ namespace ts {
2227
2227
return finishNode ( method ) ;
2228
2228
}
2229
2229
else {
2230
- const property = < PropertyDeclaration > createNode ( SyntaxKind . PropertySignature , fullStart ) ;
2230
+ const property = < PropertySignature > createNode ( SyntaxKind . PropertySignature , fullStart ) ;
2231
2231
property . name = name ;
2232
2232
property . questionToken = questionToken ;
2233
2233
property . type = parseTypeAnnotation ( ) ;
@@ -2243,7 +2243,7 @@ namespace ts {
2243
2243
case SyntaxKind . OpenBracketToken : // Both for indexers and computed properties
2244
2244
return true ;
2245
2245
default :
2246
- if ( isModifier ( token ) ) {
2246
+ if ( isModifierKind ( token ) ) {
2247
2247
const result = lookAhead ( isStartOfIndexSignatureDeclaration ) ;
2248
2248
if ( result ) {
2249
2249
return result ;
@@ -2255,7 +2255,7 @@ namespace ts {
2255
2255
}
2256
2256
2257
2257
function isStartOfIndexSignatureDeclaration ( ) {
2258
- while ( isModifier ( token ) ) {
2258
+ while ( isModifierKind ( token ) ) {
2259
2259
nextToken ( ) ;
2260
2260
}
2261
2261
@@ -2271,7 +2271,7 @@ namespace ts {
2271
2271
canParseSemicolon ( ) ;
2272
2272
}
2273
2273
2274
- function parseTypeMember ( ) : Declaration {
2274
+ function parseTypeMember ( ) : TypeElement {
2275
2275
switch ( token ) {
2276
2276
case SyntaxKind . OpenParenToken :
2277
2277
case SyntaxKind . LessThanToken :
@@ -2296,7 +2296,7 @@ namespace ts {
2296
2296
// when incrementally parsing as the parser will produce the Index declaration
2297
2297
// if it has the same text regardless of whether it is inside a class or an
2298
2298
// object type.
2299
- if ( isModifier ( token ) ) {
2299
+ if ( isModifierKind ( token ) ) {
2300
2300
const result = tryParse ( parseIndexSignatureWithModifiers ) ;
2301
2301
if ( result ) {
2302
2302
return result ;
@@ -2329,14 +2329,14 @@ namespace ts {
2329
2329
return finishNode ( node ) ;
2330
2330
}
2331
2331
2332
- function parseObjectTypeMembers ( ) : NodeArray < Declaration > {
2333
- let members : NodeArray < Declaration > ;
2332
+ function parseObjectTypeMembers ( ) : NodeArray < TypeElement > {
2333
+ let members : NodeArray < TypeElement > ;
2334
2334
if ( parseExpected ( SyntaxKind . OpenBraceToken ) ) {
2335
2335
members = parseList ( ParsingContext . TypeMembers , parseTypeMember ) ;
2336
2336
parseExpected ( SyntaxKind . CloseBraceToken ) ;
2337
2337
}
2338
2338
else {
2339
- members = createMissingList < Declaration > ( ) ;
2339
+ members = createMissingList < TypeElement > ( ) ;
2340
2340
}
2341
2341
2342
2342
return members ;
@@ -2478,11 +2478,11 @@ namespace ts {
2478
2478
// ( ...
2479
2479
return true ;
2480
2480
}
2481
- if ( isIdentifier ( ) || isModifier ( token ) ) {
2481
+ if ( isIdentifier ( ) || isModifierKind ( token ) ) {
2482
2482
nextToken ( ) ;
2483
2483
if ( token === SyntaxKind . ColonToken || token === SyntaxKind . CommaToken ||
2484
2484
token === SyntaxKind . QuestionToken || token === SyntaxKind . EqualsToken ||
2485
- isIdentifier ( ) || isModifier ( token ) ) {
2485
+ isIdentifier ( ) || isModifierKind ( token ) ) {
2486
2486
// ( id :
2487
2487
// ( id ,
2488
2488
// ( id ?
@@ -2889,7 +2889,7 @@ namespace ts {
2889
2889
}
2890
2890
2891
2891
// This *could* be a parenthesized arrow function.
2892
- // Return Unknown to const the caller know.
2892
+ // Return Unknown to let the caller know.
2893
2893
return Tristate . Unknown ;
2894
2894
}
2895
2895
else {
@@ -2988,7 +2988,7 @@ namespace ts {
2988
2988
// user meant to supply a block. For example, if the user wrote:
2989
2989
//
2990
2990
// a =>
2991
- // const v = 0;
2991
+ // let v = 0;
2992
2992
// }
2993
2993
//
2994
2994
// they may be missing an open brace. Check to see if that's the case so we can
@@ -3215,7 +3215,7 @@ namespace ts {
3215
3215
3216
3216
/**
3217
3217
* Parse ES7 unary expression and await expression
3218
- *
3218
+ *
3219
3219
* ES7 UnaryExpression:
3220
3220
* 1) SimpleUnaryExpression[?yield]
3221
3221
* 2) IncrementExpression[?yield] ** UnaryExpression[?yield]
@@ -4716,7 +4716,7 @@ namespace ts {
4716
4716
return finishNode ( node ) ;
4717
4717
}
4718
4718
4719
- function parseMethodDeclaration ( fullStart : number , decorators : NodeArray < Decorator > , modifiers : ModifiersArray , asteriskToken : Node , name : DeclarationName , questionToken : Node , diagnosticMessage ?: DiagnosticMessage ) : MethodDeclaration {
4719
+ function parseMethodDeclaration ( fullStart : number , decorators : NodeArray < Decorator > , modifiers : ModifiersArray , asteriskToken : Node , name : PropertyName , questionToken : Node , diagnosticMessage ?: DiagnosticMessage ) : MethodDeclaration {
4720
4720
const method = < MethodDeclaration > createNode ( SyntaxKind . MethodDeclaration , fullStart ) ;
4721
4721
method . decorators = decorators ;
4722
4722
setModifiers ( method , modifiers ) ;
@@ -4730,7 +4730,7 @@ namespace ts {
4730
4730
return finishNode ( method ) ;
4731
4731
}
4732
4732
4733
- function parsePropertyDeclaration ( fullStart : number , decorators : NodeArray < Decorator > , modifiers : ModifiersArray , name : DeclarationName , questionToken : Node ) : ClassElement {
4733
+ function parsePropertyDeclaration ( fullStart : number , decorators : NodeArray < Decorator > , modifiers : ModifiersArray , name : PropertyName , questionToken : Node ) : ClassElement {
4734
4734
const property = < PropertyDeclaration > createNode ( SyntaxKind . PropertyDeclaration , fullStart ) ;
4735
4735
property . decorators = decorators ;
4736
4736
setModifiers ( property , modifiers ) ;
@@ -4804,7 +4804,7 @@ namespace ts {
4804
4804
}
4805
4805
4806
4806
// Eat up all modifiers, but hold on to the last one in case it is actually an identifier.
4807
- while ( isModifier ( token ) ) {
4807
+ while ( isModifierKind ( token ) ) {
4808
4808
idToken = token ;
4809
4809
// If the idToken is a class modifier (protected, private, public, and static), it is
4810
4810
// certain that we are starting to parse class member. This allows better error recovery
@@ -5014,8 +5014,8 @@ namespace ts {
5014
5014
// implements is a future reserved word so
5015
5015
// 'class implements' might mean either
5016
5016
// - class expression with omitted name, 'implements' starts heritage clause
5017
- // - class with name 'implements'
5018
- // 'isImplementsClause' helps to disambiguate between these two cases
5017
+ // - class with name 'implements'
5018
+ // 'isImplementsClause' helps to disambiguate between these two cases
5019
5019
return isIdentifier ( ) && ! isImplementsClause ( )
5020
5020
? parseIdentifier ( )
5021
5021
: undefined ;
0 commit comments