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 ,
@@ -11,9 +10,10 @@ import { BaseNodeFactory } from "./factory/baseNodeFactory";
11
10
import { createNodeFactory , NodeFactoryFlags } from "./factory/nodeFactory" ;
12
11
import {
13
12
isAsyncModifier , isExportAssignment , isExportDeclaration , isExportModifier , isExternalModuleReference ,
14
- isFunctionTypeNode , isImportDeclaration , isImportEqualsDeclaration , isJSDocFunctionType , isJSDocNullableType ,
15
- isJSDocReturnTag , isJSDocTypeTag , isJsxOpeningElement , isJsxOpeningFragment , isMetaProperty , isNonNullExpression ,
16
- isPrivateIdentifier , isTaggedTemplateExpression , isTypeReferenceNode ,
13
+ isFunctionTypeNode , isIdentifier as isIdentifierNode , isImportDeclaration , isImportEqualsDeclaration ,
14
+ isJSDocFunctionType , isJSDocNullableType , isJSDocReturnTag , isJSDocTypeTag , isJsxOpeningElement ,
15
+ isJsxOpeningFragment , isMetaProperty , isNonNullExpression , isPrivateIdentifier , isTaggedTemplateExpression ,
16
+ isTypeReferenceNode ,
17
17
} from "./factory/nodeTests" ;
18
18
import { setTextRange } from "./factory/utilitiesPublic" ;
19
19
import { fileExtensionIsOneOf , normalizePath } from "./path" ;
@@ -1757,7 +1757,7 @@ namespace Parser {
1757
1757
}
1758
1758
1759
1759
// 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 ;
1760
+ const expressionText = isIdentifierNode ( node ) ? idText ( node ) : undefined ;
1761
1761
if ( ! expressionText || ! isIdentifierText ( expressionText , languageVersion ) ) {
1762
1762
parseErrorAtCurrentToken ( Diagnostics . _0_expected , tokenToString ( SyntaxKind . SemicolonToken ) ) ;
1763
1763
return ;
@@ -6335,7 +6335,7 @@ namespace Parser {
6335
6335
let node : ExpressionStatement | LabeledStatement ;
6336
6336
const hasParen = token ( ) === SyntaxKind . OpenParenToken ;
6337
6337
const expression = allowInAnd ( parseExpression ) ;
6338
- if ( ts . isIdentifier ( expression ) && parseOptional ( SyntaxKind . ColonToken ) ) {
6338
+ if ( isIdentifierNode ( expression ) && parseOptional ( SyntaxKind . ColonToken ) ) {
6339
6339
node = factory . createLabeledStatement ( expression , parseStatement ( ) ) ;
6340
6340
}
6341
6341
else {
@@ -8393,7 +8393,7 @@ namespace Parser {
8393
8393
case SyntaxKind . ArrayType :
8394
8394
return isObjectOrObjectArrayTypeReference ( ( node as ArrayTypeNode ) . elementType ) ;
8395
8395
default :
8396
- return isTypeReferenceNode ( node ) && ts . isIdentifier ( node . typeName ) && node . typeName . escapedText === "Object" && ! node . typeArguments ;
8396
+ return isTypeReferenceNode ( node ) && isIdentifierNode ( node . typeName ) && node . typeName . escapedText === "Object" && ! node . typeArguments ;
8397
8397
}
8398
8398
}
8399
8399
@@ -8664,8 +8664,8 @@ namespace Parser {
8664
8664
}
8665
8665
8666
8666
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 ) {
8667
+ while ( ! isIdentifierNode ( a ) || ! isIdentifierNode ( b ) ) {
8668
+ if ( ! isIdentifierNode ( a ) && ! isIdentifierNode ( b ) && a . right . escapedText === b . right . escapedText ) {
8669
8669
a = a . left ;
8670
8670
b = b . left ;
8671
8671
}
@@ -8690,7 +8690,7 @@ namespace Parser {
8690
8690
const child = tryParseChildTag ( target , indent ) ;
8691
8691
if ( child && ( child . kind === SyntaxKind . JSDocParameterTag || child . kind === SyntaxKind . JSDocPropertyTag ) &&
8692
8692
target !== PropertyLikeParse . CallbackParameter &&
8693
- name && ( ts . isIdentifier ( child . name ) || ! escapedTextsEqual ( name , child . name . left ) ) ) {
8693
+ name && ( isIdentifierNode ( child . name ) || ! escapedTextsEqual ( name , child . name . left ) ) ) {
8694
8694
return false ;
8695
8695
}
8696
8696
return child ;
0 commit comments