Merge branch 'master' into named-tuple-members · microsoft/TypeScript@a7aa566 (original) (raw)

`@@ -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

`!(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

`}

`

`@@ -3402,7 +3402,7 @@ namespace ts {

`

3402

3402

`case SyntaxKind.ModuleDeclaration:

`

3403

3403

`return getModuleInstanceState(s as ModuleDeclaration) !== ModuleInstanceState.Instantiated;

`

3404

3404

`case SyntaxKind.EnumDeclaration:

`

3405

``

`-

return hasModifier(s, ModifierFlags.Const);

`

``

3405

`+

return hasSyntacticModifier(s, ModifierFlags.Const);

`

3406

3406

`default:

`

3407

3407

`return false;

`

3408

3408

`}

`

`@@ -3636,7 +3636,7 @@ namespace ts {

`

3636

3636

`}

`

3637

3637

``

3638

3638

`// If a parameter has an accessibility modifier, then it is TypeScript syntax.

`

3639

``

`-

if (hasModifier(node, ModifierFlags.ParameterPropertyModifier)) {

`

``

3639

`+

if (hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier)) {

`

3640

3640

`transformFlags |= TransformFlags.AssertTypeScript | TransformFlags.ContainsTypeScriptClassSyntax;

`

3641

3641

`}

`

3642

3642

``

`@@ -3675,7 +3675,7 @@ namespace ts {

`

3675

3675

`function computeClassDeclaration(node: ClassDeclaration, subtreeFlags: TransformFlags) {

`

3676

3676

`let transformFlags: TransformFlags;

`

3677

3677

``

3678

``

`-

if (hasModifier(node, ModifierFlags.Ambient)) {

`

``

3678

`+

if (hasSyntacticModifier(node, ModifierFlags.Ambient)) {

`

3679

3679

`// An ambient declaration is TypeScript syntax.

`

3680

3680

`transformFlags = TransformFlags.AssertTypeScript;

`

3681

3681

`}

`

`@@ -3766,7 +3766,7 @@ namespace ts {

`

3766

3766

`let transformFlags = subtreeFlags;

`

3767

3767

``

3768

3768

`// TypeScript-specific modifiers and overloads are TypeScript syntax

`

3769

``

`-

if (hasModifier(node, ModifierFlags.TypeScriptModifier)

`

``

3769

`+

if (hasSyntacticModifier(node, ModifierFlags.TypeScriptModifier)

`

3770

3770

`|| !node.body) {

`

3771

3771

`transformFlags |= TransformFlags.AssertTypeScript;

`

3772

3772

`}

`

`@@ -3787,7 +3787,7 @@ namespace ts {

`

3787

3787

`// Decorators, TypeScript-specific modifiers, type parameters, type annotations, and

`

3788

3788

`// overloads are TypeScript syntax.

`

3789

3789

`if (node.decorators

`

3790

``

`-

|| hasModifier(node, ModifierFlags.TypeScriptModifier)

`

``

3790

`+

|| hasSyntacticModifier(node, ModifierFlags.TypeScriptModifier)

`

3791

3791

`|| node.typeParameters

`

3792

3792

`|| node.type

`

3793

3793

`|| !node.body

`

`@@ -3801,7 +3801,7 @@ namespace ts {

`

3801

3801

`}

`

3802

3802

``

3803

3803

`// An async method declaration is ES2017 syntax.

`

3804

``

`-

if (hasModifier(node, ModifierFlags.Async)) {

`

``

3804

`+

if (hasSyntacticModifier(node, ModifierFlags.Async)) {

`

3805

3805

`transformFlags |= node.asteriskToken ? TransformFlags.AssertES2018 : TransformFlags.AssertES2017;

`

3806

3806

`}

`

3807

3807

``

`@@ -3819,7 +3819,7 @@ namespace ts {

`

3819

3819

`// Decorators, TypeScript-specific modifiers, type annotations, and overloads are

`

3820

3820

`// TypeScript syntax.

`

3821

3821

`if (node.decorators

`

3822

``

`-

|| hasModifier(node, ModifierFlags.TypeScriptModifier)

`

``

3822

`+

|| hasSyntacticModifier(node, ModifierFlags.TypeScriptModifier)

`

3823

3823

`|| node.type

`

3824

3824

`|| !node.body) {

`

3825

3825

`transformFlags |= TransformFlags.AssertTypeScript;

`

`@@ -3838,7 +3838,7 @@ namespace ts {

`

3838

3838

`let transformFlags = subtreeFlags | TransformFlags.ContainsClassFields;

`

3839

3839

``

3840

3840

`// Decorators, TypeScript-specific modifiers, and type annotations are TypeScript syntax.

`

3841

``

`-

if (some(node.decorators) || hasModifier(node, ModifierFlags.TypeScriptModifier) || node.type || node.questionToken || node.exclamationToken) {

`

``

3841

`+

if (some(node.decorators) || hasSyntacticModifier(node, ModifierFlags.TypeScriptModifier) || node.type || node.questionToken || node.exclamationToken) {

`

3842

3842

`transformFlags |= TransformFlags.AssertTypeScript;

`

3843

3843

`}

`

3844

3844

``

`@@ -3853,7 +3853,7 @@ namespace ts {

`

3853

3853

``

3854

3854

`function computeFunctionDeclaration(node: FunctionDeclaration, subtreeFlags: TransformFlags) {

`

3855

3855

`let transformFlags: TransformFlags;

`

3856

``

`-

const modifierFlags = getModifierFlags(node);

`

``

3856

`+

const modifierFlags = getSyntacticModifierFlags(node);

`

3857

3857

`const body = node.body;

`

3858

3858

``

3859

3859

`if (!body || (modifierFlags & ModifierFlags.Ambient)) {

`

`@@ -3901,14 +3901,14 @@ namespace ts {

`

3901

3901

``

3902

3902

`// TypeScript-specific modifiers, type parameters, and type annotations are TypeScript

`

3903

3903

`// syntax.

`

3904

``

`-

if (hasModifier(node, ModifierFlags.TypeScriptModifier)

`

``

3904

`+

if (hasSyntacticModifier(node, ModifierFlags.TypeScriptModifier)

`

3905

3905

`|| node.typeParameters

`

3906

3906

`|| node.type) {

`

3907

3907

`transformFlags |= TransformFlags.AssertTypeScript;

`

3908

3908

`}

`

3909

3909

``

3910

3910

`// An async function expression is ES2017 syntax.

`

3911

``

`-

if (hasModifier(node, ModifierFlags.Async)) {

`

``

3911

`+

if (hasSyntacticModifier(node, ModifierFlags.Async)) {

`

3912

3912

`transformFlags |= node.asteriskToken ? TransformFlags.AssertES2018 : TransformFlags.AssertES2017;

`

3913

3913

`}

`

3914

3914

``

`@@ -3934,14 +3934,14 @@ namespace ts {

`

3934

3934

``

3935

3935

`// TypeScript-specific modifiers, type parameters, and type annotations are TypeScript

`

3936

3936

`// syntax.

`

3937

``

`-

if (hasModifier(node, ModifierFlags.TypeScriptModifier)

`

``

3937

`+

if (hasSyntacticModifier(node, ModifierFlags.TypeScriptModifier)

`

3938

3938

`|| node.typeParameters

`

3939

3939

`|| node.type) {

`

3940

3940

`transformFlags |= TransformFlags.AssertTypeScript;

`

3941

3941

`}

`

3942

3942

``

3943

3943

`// An async arrow function is ES2017 syntax.

`

3944

``

`-

if (hasModifier(node, ModifierFlags.Async)) {

`

``

3944

`+

if (hasSyntacticModifier(node, ModifierFlags.Async)) {

`

3945

3945

`transformFlags |= TransformFlags.AssertES2017;

`

3946

3946

`}

`

3947

3947

``

`@@ -4015,7 +4015,7 @@ namespace ts {

`

4015

4015

`const declarationListTransformFlags = node.declarationList.transformFlags;

`

4016

4016

``

4017

4017

`// An ambient declaration is TypeScript syntax.

`

4018

``

`-

if (hasModifier(node, ModifierFlags.Ambient)) {

`

``

4018

`+

if (hasSyntacticModifier(node, ModifierFlags.Ambient)) {

`

4019

4019

`transformFlags = TransformFlags.AssertTypeScript;

`

4020

4020

`}

`

4021

4021

`else {

`

`@@ -4063,7 +4063,7 @@ namespace ts {

`

4063

4063

``

4064

4064

`function computeModuleDeclaration(node: ModuleDeclaration, subtreeFlags: TransformFlags) {

`

4065

4065

`let transformFlags = TransformFlags.AssertTypeScript;

`

4066

``

`-

const modifierFlags = getModifierFlags(node);

`

``

4066

`+

const modifierFlags = getSyntacticModifierFlags(node);

`

4067

4067

``

4068

4068

`if ((modifierFlags & ModifierFlags.Ambient) === 0) {

`

4069

4069

`transformFlags |= subtreeFlags;

`