@@ -50,7 +50,7 @@ namespace ts {
50
50
// 3. non-exported import declarations
51
51
case SyntaxKind . ImportDeclaration :
52
52
case SyntaxKind . ImportEqualsDeclaration :
53
- if ( ! ( hasModifier ( node , ModifierFlags . Export ) ) ) {
53
+ if ( ! ( hasSyntacticModifier ( node , ModifierFlags . Export ) ) ) {
54
54
return ModuleInstanceState . NonInstantiated ;
55
55
}
56
56
break ;
@@ -413,7 +413,7 @@ namespace ts {
413
413
function declareSymbol ( symbolTable : SymbolTable , parent : Symbol | undefined , node : Declaration , includes : SymbolFlags , excludes : SymbolFlags , isReplaceableByMethod ?: boolean ) : Symbol {
414
414
Debug . assert ( ! hasDynamicName ( node ) ) ;
415
415
416
- const isDefaultExport = hasModifier ( node , ModifierFlags . Default ) || isExportSpecifier ( node ) && node . name . escapedText === "default" ;
416
+ const isDefaultExport = hasSyntacticModifier ( node , ModifierFlags . Default ) || isExportSpecifier ( node ) && node . name . escapedText === "default" ;
417
417
418
418
// The exported symbol for an export default function/class node is always named "default"
419
419
const name = isDefaultExport && parent ? InternalSymbolName . Default : getDeclarationName ( node ) ;
@@ -508,7 +508,7 @@ namespace ts {
508
508
}
509
509
510
510
const relatedInformation : DiagnosticRelatedInformation [ ] = [ ] ;
511
- if ( isTypeAliasDeclaration ( node ) && nodeIsMissing ( node . type ) && hasModifier ( node , ModifierFlags . Export ) && symbol . flags & ( SymbolFlags . Alias | SymbolFlags . Type | SymbolFlags . Namespace ) ) {
511
+ if ( isTypeAliasDeclaration ( node ) && nodeIsMissing ( node . type ) && hasSyntacticModifier ( node , ModifierFlags . Export ) && symbol . flags & ( SymbolFlags . Alias | SymbolFlags . Type | SymbolFlags . Namespace ) ) {
512
512
// export type T; - may have meant export type { T }?
513
513
relatedInformation . push ( createDiagnosticForNode ( node , Diagnostics . Did_you_mean_0 , `export type { ${ unescapeLeadingUnderscores ( node . name . escapedText ) } }` ) ) ;
514
514
}
@@ -572,7 +572,7 @@ namespace ts {
572
572
// and should never be merged directly with other augmentation, and the latter case would be possible if automatic merge is allowed.
573
573
if ( isJSDocTypeAlias ( node ) ) Debug . assert ( isInJSFile ( node ) ) ; // We shouldn't add symbols for JSDoc nodes if not in a JS file.
574
574
if ( ( ! isAmbientModule ( node ) && ( hasExportModifier || container . flags & NodeFlags . ExportContext ) ) || isJSDocTypeAlias ( node ) ) {
575
- if ( ! container . locals || ( hasModifier ( node , ModifierFlags . Default ) && ! getDeclarationName ( node ) ) ) {
575
+ if ( ! container . locals || ( hasSyntacticModifier ( node , ModifierFlags . Default ) && ! getDeclarationName ( node ) ) ) {
576
576
return declareSymbol ( container . symbol . exports ! , container . symbol , node , symbolFlags , symbolExcludes ) ; // No local symbol for an unnamed default!
577
577
}
578
578
const exportKind = symbolFlags & SymbolFlags . Value ? SymbolFlags . ExportValue : 0 ;
@@ -637,7 +637,7 @@ namespace ts {
637
637
const saveExceptionTarget = currentExceptionTarget ;
638
638
const saveActiveLabelList = activeLabelList ;
639
639
const saveHasExplicitReturn = hasExplicitReturn ;
640
- const isIIFE = containerFlags & ContainerFlags . IsFunctionExpression && ! hasModifier ( node , ModifierFlags . Async ) &&
640
+ const isIIFE = containerFlags & ContainerFlags . IsFunctionExpression && ! hasSyntacticModifier ( node , ModifierFlags . Async ) &&
641
641
! ( < FunctionLikeDeclaration > node ) . asteriskToken && ! ! getImmediatelyInvokedFunctionExpression ( node ) ;
642
642
// A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave
643
643
// similarly to break statements that exit to a label just past the statement body.
@@ -1906,7 +1906,7 @@ namespace ts {
1906
1906
}
1907
1907
1908
1908
function declareClassMember ( node : Declaration , symbolFlags : SymbolFlags , symbolExcludes : SymbolFlags ) {
1909
- return hasModifier ( node , ModifierFlags . Static )
1909
+ return hasSyntacticModifier ( node , ModifierFlags . Static )
1910
1910
? declareSymbol ( container . symbol . exports ! , container . symbol , node , symbolFlags , symbolExcludes )
1911
1911
: declareSymbol ( container . symbol . members ! , container . symbol , node , symbolFlags , symbolExcludes ) ;
1912
1912
}
@@ -1936,7 +1936,7 @@ namespace ts {
1936
1936
function bindModuleDeclaration ( node : ModuleDeclaration ) {
1937
1937
setExportContextFlag ( node ) ;
1938
1938
if ( isAmbientModule ( node ) ) {
1939
- if ( hasModifier ( node , ModifierFlags . Export ) ) {
1939
+ if ( hasSyntacticModifier ( node , ModifierFlags . Export ) ) {
1940
1940
errorOnFirstToken ( node , Diagnostics . export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible ) ;
1941
1941
}
1942
1942
if ( isModuleAugmentationExternal ( node ) ) {
@@ -2869,7 +2869,7 @@ namespace ts {
2869
2869
// this.foo assignment in a JavaScript class
2870
2870
// Bind this property to the containing class
2871
2871
const containingClass = thisContainer . parent ;
2872
- const symbolTable = hasModifier ( thisContainer , ModifierFlags . Static ) ? containingClass . symbol . exports ! : containingClass . symbol . members ! ;
2872
+ const symbolTable = hasSyntacticModifier ( thisContainer , ModifierFlags . Static ) ? containingClass . symbol . exports ! : containingClass . symbol . members ! ;
2873
2873
if ( hasDynamicName ( node ) ) {
2874
2874
bindDynamicallyNamedThisPropertyAssignment ( node , containingClass . symbol ) ;
2875
2875
}
@@ -3403,7 +3403,7 @@ namespace ts {
3403
3403
case SyntaxKind . ModuleDeclaration :
3404
3404
return getModuleInstanceState ( s as ModuleDeclaration ) !== ModuleInstanceState . Instantiated ;
3405
3405
case SyntaxKind . EnumDeclaration :
3406
- return hasModifier ( s , ModifierFlags . Const ) ;
3406
+ return hasSyntacticModifier ( s , ModifierFlags . Const ) ;
3407
3407
default :
3408
3408
return false ;
3409
3409
}
@@ -3637,7 +3637,7 @@ namespace ts {
3637
3637
}
3638
3638
3639
3639
// If a parameter has an accessibility modifier, then it is TypeScript syntax.
3640
- if ( hasModifier ( node , ModifierFlags . ParameterPropertyModifier ) ) {
3640
+ if ( hasSyntacticModifier ( node , ModifierFlags . ParameterPropertyModifier ) ) {
3641
3641
transformFlags |= TransformFlags . AssertTypeScript | TransformFlags . ContainsTypeScriptClassSyntax ;
3642
3642
}
3643
3643
@@ -3676,7 +3676,7 @@ namespace ts {
3676
3676
function computeClassDeclaration ( node : ClassDeclaration , subtreeFlags : TransformFlags ) {
3677
3677
let transformFlags : TransformFlags ;
3678
3678
3679
- if ( hasModifier ( node , ModifierFlags . Ambient ) ) {
3679
+ if ( hasSyntacticModifier ( node , ModifierFlags . Ambient ) ) {
3680
3680
// An ambient declaration is TypeScript syntax.
3681
3681
transformFlags = TransformFlags . AssertTypeScript ;
3682
3682
}
@@ -3767,7 +3767,7 @@ namespace ts {
3767
3767
let transformFlags = subtreeFlags ;
3768
3768
3769
3769
// TypeScript-specific modifiers and overloads are TypeScript syntax
3770
- if ( hasModifier ( node , ModifierFlags . TypeScriptModifier )
3770
+ if ( hasSyntacticModifier ( node , ModifierFlags . TypeScriptModifier )
3771
3771
|| ! node . body ) {
3772
3772
transformFlags |= TransformFlags . AssertTypeScript ;
3773
3773
}
@@ -3788,7 +3788,7 @@ namespace ts {
3788
3788
// Decorators, TypeScript-specific modifiers, type parameters, type annotations, and
3789
3789
// overloads are TypeScript syntax.
3790
3790
if ( node . decorators
3791
- || hasModifier ( node , ModifierFlags . TypeScriptModifier )
3791
+ || hasSyntacticModifier ( node , ModifierFlags . TypeScriptModifier )
3792
3792
|| node . typeParameters
3793
3793
|| node . type
3794
3794
|| ! node . body
@@ -3802,7 +3802,7 @@ namespace ts {
3802
3802
}
3803
3803
3804
3804
// An async method declaration is ES2017 syntax.
3805
- if ( hasModifier ( node , ModifierFlags . Async ) ) {
3805
+ if ( hasSyntacticModifier ( node , ModifierFlags . Async ) ) {
3806
3806
transformFlags |= node . asteriskToken ? TransformFlags . AssertES2018 : TransformFlags . AssertES2017 ;
3807
3807
}
3808
3808
@@ -3820,7 +3820,7 @@ namespace ts {
3820
3820
// Decorators, TypeScript-specific modifiers, type annotations, and overloads are
3821
3821
// TypeScript syntax.
3822
3822
if ( node . decorators
3823
- || hasModifier ( node , ModifierFlags . TypeScriptModifier )
3823
+ || hasSyntacticModifier ( node , ModifierFlags . TypeScriptModifier )
3824
3824
|| node . type
3825
3825
|| ! node . body ) {
3826
3826
transformFlags |= TransformFlags . AssertTypeScript ;
@@ -3839,7 +3839,7 @@ namespace ts {
3839
3839
let transformFlags = subtreeFlags | TransformFlags . ContainsClassFields ;
3840
3840
3841
3841
// Decorators, TypeScript-specific modifiers, and type annotations are TypeScript syntax.
3842
- if ( some ( node . decorators ) || hasModifier ( node , ModifierFlags . TypeScriptModifier ) || node . type || node . questionToken || node . exclamationToken ) {
3842
+ if ( some ( node . decorators ) || hasSyntacticModifier ( node , ModifierFlags . TypeScriptModifier ) || node . type || node . questionToken || node . exclamationToken ) {
3843
3843
transformFlags |= TransformFlags . AssertTypeScript ;
3844
3844
}
3845
3845
@@ -3854,7 +3854,7 @@ namespace ts {
3854
3854
3855
3855
function computeFunctionDeclaration ( node : FunctionDeclaration , subtreeFlags : TransformFlags ) {
3856
3856
let transformFlags : TransformFlags ;
3857
- const modifierFlags = getModifierFlags ( node ) ;
3857
+ const modifierFlags = getSyntacticModifierFlags ( node ) ;
3858
3858
const body = node . body ;
3859
3859
3860
3860
if ( ! body || ( modifierFlags & ModifierFlags . Ambient ) ) {
@@ -3902,14 +3902,14 @@ namespace ts {
3902
3902
3903
3903
// TypeScript-specific modifiers, type parameters, and type annotations are TypeScript
3904
3904
// syntax.
3905
- if ( hasModifier ( node , ModifierFlags . TypeScriptModifier )
3905
+ if ( hasSyntacticModifier ( node , ModifierFlags . TypeScriptModifier )
3906
3906
|| node . typeParameters
3907
3907
|| node . type ) {
3908
3908
transformFlags |= TransformFlags . AssertTypeScript ;
3909
3909
}
3910
3910
3911
3911
// An async function expression is ES2017 syntax.
3912
- if ( hasModifier ( node , ModifierFlags . Async ) ) {
3912
+ if ( hasSyntacticModifier ( node , ModifierFlags . Async ) ) {
3913
3913
transformFlags |= node . asteriskToken ? TransformFlags . AssertES2018 : TransformFlags . AssertES2017 ;
3914
3914
}
3915
3915
@@ -3935,14 +3935,14 @@ namespace ts {
3935
3935
3936
3936
// TypeScript-specific modifiers, type parameters, and type annotations are TypeScript
3937
3937
// syntax.
3938
- if ( hasModifier ( node , ModifierFlags . TypeScriptModifier )
3938
+ if ( hasSyntacticModifier ( node , ModifierFlags . TypeScriptModifier )
3939
3939
|| node . typeParameters
3940
3940
|| node . type ) {
3941
3941
transformFlags |= TransformFlags . AssertTypeScript ;
3942
3942
}
3943
3943
3944
3944
// An async arrow function is ES2017 syntax.
3945
- if ( hasModifier ( node , ModifierFlags . Async ) ) {
3945
+ if ( hasSyntacticModifier ( node , ModifierFlags . Async ) ) {
3946
3946
transformFlags |= TransformFlags . AssertES2017 ;
3947
3947
}
3948
3948
@@ -4016,7 +4016,7 @@ namespace ts {
4016
4016
const declarationListTransformFlags = node . declarationList . transformFlags ;
4017
4017
4018
4018
// An ambient declaration is TypeScript syntax.
4019
- if ( hasModifier ( node , ModifierFlags . Ambient ) ) {
4019
+ if ( hasSyntacticModifier ( node , ModifierFlags . Ambient ) ) {
4020
4020
transformFlags = TransformFlags . AssertTypeScript ;
4021
4021
}
4022
4022
else {
@@ -4064,7 +4064,7 @@ namespace ts {
4064
4064
4065
4065
function computeModuleDeclaration ( node : ModuleDeclaration , subtreeFlags : TransformFlags ) {
4066
4066
let transformFlags = TransformFlags . AssertTypeScript ;
4067
- const modifierFlags = getModifierFlags ( node ) ;
4067
+ const modifierFlags = getSyntacticModifierFlags ( node ) ;
4068
4068
4069
4069
if ( ( modifierFlags & ModifierFlags . Ambient ) === 0 ) {
4070
4070
transformFlags |= subtreeFlags ;
0 commit comments