@@ -12,10 +12,6 @@ namespace ts {
12
12
export function createNode ( kind : SyntaxKind ) : Node {
13
13
return new ( getNodeConstructor ( kind ) ) ( ) ;
14
14
}
15
-
16
- export function tokenIsIdentifierOrKeyword ( token : SyntaxKind )
10000
: boolean {
17
- return token >= SyntaxKind . Identifier ;
18
- }
19
15
20
16
function visitNode < T > ( cbNode : ( node : Node ) => T , node : Node ) : T {
21
17
if ( node ) {
@@ -1062,11 +1058,11 @@ namespace ts {
1062
1058
}
1063
1059
1064
1060
function parseIdentifierName ( ) : Identifier {
1065
- return createIdentifier ( isIdentifierOrKeyword ( ) ) ;
1061
+ return createIdentifier ( tokenIsIdentifierOrKeyword ( token ) ) ;
1066
1062
}
1067
1063
1068
1064
function isLiteralPropertyName ( ) : boolean {
1069
- return isIdentifierOrKeyword ( ) ||
1065
+ return tokenIsIdentifierOrKeyword ( token ) ||
1070
1066
token === SyntaxKind . StringLiteral ||
1071
1067
token === SyntaxKind . NumericLiteral ;
1072
1068
}
@@ -1090,7 +1086,7 @@ namespace ts {
1090
1086
}
1091
1087
1092
1088
function isSimplePropertyName ( ) {
1093
- return token === SyntaxKind . StringLiteral || token === SyntaxKind . NumericLiteral || isIdentifierOrKeyword ( ) ;
1089
+ return token === SyntaxKind . StringLiteral || token === SyntaxKind . NumericLiteral || tokenIsIdentifierOrKeyword ( token ) ;
1094
1090
}
1095
1091
1096
1092
function parseComputedPropertyName ( ) : ComputedPropertyName {
@@ -1217,9 +1213,9 @@ namespace ts {
1217
1213
case ParsingContext . HeritageClauses :
1218
1214
return isHeritageClause ( ) ;
1219
1215
case ParsingContext . ImportOrExportSpecifiers :
1220
- return isIdentifierOrKeyword ( ) ;
1216
+ return tokenIsIdentifierOrKeyword ( token ) ;
1221
1217
case ParsingContext . JsxAttributes :
1222
- return isIdentifierOrKeyword ( ) || token === SyntaxKind . OpenBraceToken ;
1218
+ return tokenIsIdentifierOrKeyword ( token ) || token === SyntaxKind . OpenBraceToken ;
1223
1219
case ParsingContext . JsxChildren :
1224
1220
return true ;
1225
1221
case ParsingContext . JSDocFunctionParameters :
@@ -1258,7 +1254,7 @@ namespace ts {
1258
1254
1259
1255
function nextTokenIsIdentifierOrKeyword ( ) {
1260
1256
nextToken ( ) ;
1261
- return isIdentifierOrKeyword ( ) ;
1257
+ return tokenIsIdentifierOrKeyword ( token ) ;
1262
1258
}
1263
1259
1264
1260
function isHeritageClauseExtendsOrImplementsKeyword ( ) : boolean {
@@ -1828,7 +1824,7 @@ namespace ts {
1828
1824
// the code would be implicitly: "name.identifierOrKeyword; identifierNameOrKeyword".
1829
1825
// In the first case though, ASI will not take effect because there is not a
1830
1826
// line terminator after the identifier or keyword.
1831
- if ( scanner . hasPrecedingLineBreak ( ) && isIdentifierOrKeyword ( ) ) {
1827
+ if ( scanner . hasPrecedingLineBreak ( ) && tokenIsIdentifierOrKeyword ( token ) ) {
1832
1828
let matchesPattern = lookAhead ( nextTokenIsIdentifierOrKeywordOnSameLine ) ;
1833
1829
1834
1830
if ( matchesPattern ) {
@@ -2286,7 +2282,7 @@ namespace ts {
2286
2282
}
2287
2283
}
2288
2284
2289
- if ( isIdentifierOrKeyword ( ) ) {
2285
+ if ( tokenIsIdentifierOrKeyword ( token ) ) {
2290
2286
return parsePropertyOrMethodSignature ( ) ;
2291
2287
}
2292
2288
}
@@ -4105,13 +4101,9 @@ namespace ts {
4105
4101
}
4106
4102
}
4107
4103
4108
- function isIdentifierOrKeyword ( ) {
4109
- return tokenIsIdentifierOrKeyword ( token ) ;
4110
- }
4111
-
4112
4104
function nextTokenIsIdentifierOrKeywordOnSameLine ( ) {
4113
4105
nextToken ( ) ;
4114
- return isIdentifierOrKeyword ( ) && ! scanner . hasPrecedingLineBreak ( ) ;
4106
+ return tokenIsIdentifierOrKeyword ( token ) && ! scanner . hasPrecedingLineBreak ( ) ;
4115
4107
}
4116
4108
4117
4109
function nextTokenIsFunctionKeywordOnSameLine ( ) {
@@ -4121,7 +4113,7 @@ namespace ts {
4121
4113
4122
4114
function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine ( ) {
4123
4115
nextToken ( ) ;
4124
- return ( isIdentifierOrKeyword ( ) || token === SyntaxKind . NumericLiteral ) && ! scanner . hasPrecedingLineBreak ( ) ;
4116
+ return ( tokenIsIdentifierOrKeyword ( token ) || token === SyntaxKind . NumericLiteral ) && ! scanner . hasPrecedingLineBreak ( ) ;
4125
4117
}
4126
4118
4127
4119
function isDeclaration ( ) : boolean {
@@ -4174,7 +4166,7 @@ namespace ts {
4174
4166
case SyntaxKind . ImportKeyword :
4175
4167
nextToken ( ) ;
4176
4168
return token === SyntaxKind . StringLiteral || token === SyntaxKind . AsteriskToken ||
4177
- token === SyntaxKind . OpenBraceToken || isIdentifierOrKeyword ( ) ;
4169
+ token === SyntaxKind . OpenBraceToken || tokenIsIdentifierOrKeyword ( token ) ;
4178
4170
case SyntaxKind . ExportKeyword :
4179
4171
nextToken ( ) ;
4180
4172
if ( token === SyntaxKind . EqualsToken || token === SyntaxKind . AsteriskToken ||
@@ -4781,7 +4773,7 @@ namespace ts {
4781
4773
4782
4774
// It is very important that we check this *after* checking indexers because
4783
4775
// the [ token can start an index signature or a computed property name
4784
- if ( isIdentifierOrKeyword ( ) ||
4776
+ if ( tokenIsIdentifierOrKeyword ( token ) ||
4785
4777
token === SyntaxKind . StringLiteral ||
4786
4778
token === SyntaxKind . NumericLiteral ||
4787
4779
token === SyntaxKind . AsteriskToken ||
@@ -5324,7 +5316,7 @@ namespace ts {
5324
5316
return true ;
5325
5317
}
5326
5318
5327
- return isIdentifierOrKeyword ( ) ;
5319
+ return tokenIsIdentifierOrKeyword ( token ) ;
5328
5320
}
5329
5321
5330
5322
export function parseJSDocTypeExpressionForTests ( content : string , start : number , length : number ) {
0 commit comments