1
- import * as ts from "./_namespaces/ts" ;
2
1
import { convertToObjectWorker } from "./commandLineParser" ;
3
2
import {
4
3
addRange , append , AssertionLevel , concatenate , emptyArray , emptyMap , findIndex , forEach , getSpellingSuggestion ,
@@ -13,7 +12,7 @@ import {
13
12
isAsyncModifier , isExportAssignment , isExportDeclaration , isExportModifier , isExternalModuleReference ,
14
13
isFunctionTypeNode , isImportDeclaration , isImportEqualsDeclaration , isJSDocFunctionType , isJSDocNullableType ,
15
14
isJSDocReturnTag , isJSDocTypeTag , isJsxOpeningElement , isJsxOpeningFragment , isMetaProperty , isNonNullExpression ,
16
- isPrivateIdentifier , isTaggedTemplateExpression , isTypeReferenceNode ,
15
+ isPrivateIdentifier , isTaggedTemplateExpression , isTypeReferenceNode , isIdentifier as isIdentifierNode ,
17
16
} from "./factory/nodeTests" ;
18
17
import { setTextRange } from "./factory/utilitiesPublic" ;
19
18
import { fileExtensionIsOneOf , normalizePath } from "./path" ;
@@ -1757,7 +1756,7 @@ namespace Parser {
1757
1756
}
1758
1757
1759
1758
// Otherwise, if this isn't a well-known keyword-like identifier, give the generic fallback message.
1760
- const expressionText = ts . isIdentifier ( node ) ? idText ( node ) : undefined ;
1759
+ const expressionText = isIdentifierNode ( node ) ? idText ( node ) : undefined ;
1761
1760
if ( ! expressionText || ! isIdentifierText ( expressionText , languageVersion ) ) {
1762
1761
parseErrorAtCurrentToken ( Diagnostics . _0_expected , tokenToString ( SyntaxKind . SemicolonToken ) ) ;
1763
1762
return ;
@@ -6335,7 +6334,7 @@ namespace Parser {
6335
6334
let node : ExpressionStatement | LabeledStatement ;
6336
6335
const hasParen = token ( ) === SyntaxKind . OpenParenToken ;
6337
6336
const expression = allowInAnd ( parseExpression ) ;
6338
- if ( ts . isIdentifier ( expression ) && parseOptional ( SyntaxKind . ColonToken ) ) {
6337
+ if ( isIdentifierNode ( expression ) && parseOptional ( SyntaxKind . ColonToken ) ) {
6339
6338
node = factory . createLabeledStatement ( expression , parseStatement ( ) ) ;
6340
6339
}
6341
6340
else {
@@ -8393,7 +8392,7 @@ namespace Parser {
8393
8392
case SyntaxKind . ArrayType :
8394
8393
return isObjectOrObjectArrayTypeReference ( ( node as ArrayTypeNode ) . elementType ) ;
8395
8394
default :
8396
- return isTypeReferenceNode ( node ) && ts . isIdentifier ( node . typeName ) && node . typeName . escapedText === "Object" && ! node . typeArguments ;
8395
+ return isTypeReferenceNode ( node ) && isIdentifierNode ( node . typeName ) && node . typeName . escapedText === "Object" && ! node . typeArguments ;
8397
8396
}
8398
8397
}
8399
8398
@@ -8664,8 +8663,8 @@ namespace Parser {
8664
8663
}
8665
8664
8666
8665
function escapedTextsEqual ( a : EntityName , b : EntityName ) : boolean {
8667
- while ( ! ts . isIdentifier ( a ) || ! ts . isIdentifier ( b ) ) {
8668
- if ( ! ts . isIdentifier ( a ) && ! ts . isIdentifier ( b ) && a . right . escapedText === b . right . escapedText ) {
8666
+ while ( ! isIdentifierNode ( a ) || ! isIdentifierNode ( b ) ) {
8667
+ if ( ! isIdentifierNode ( a ) && ! isIdentifierNode ( b ) && a . right . escapedText === b . right . escapedText ) {
8669
8668
a = a . left ;
8670
8669
b = b . left ;
8671
8670
}
@@ -8690,7 +8689,7 @@ namespace Parser {
8690
8689
const child = tryParseChildTag ( target , indent ) ;
8691
8690
if ( child && ( child . kind === SyntaxKind . JSDocParameterTag || child . kind === SyntaxKind . JSDocPropertyTag ) &&
8692
8691
target !== PropertyLikeParse . CallbackParameter &&
8693
- name && ( ts . isIdentifier ( child . name ) || ! escapedTextsEqual ( name , child . name . left ) ) ) {
8692
+ name && ( isIdentifierNode ( child . name ) || ! escapedTextsEqual ( name , child . name . left ) ) ) {
8694
8693
return false ;
8695
8694
}
8696
8695
return child ;
0 commit comments