Skip to content

Commit 3240000

Browse files
committed
Merge branch 'master' into interfaceFixes
2 parents aa6ecd4 + 137c99b commit 3240000

579 files changed

Lines changed: 6862 additions & 3712 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Jakefile.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ var compilerSources = [
7070
"visitor.ts",
7171
"transformers/destructuring.ts",
7272
"transformers/ts.ts",
73-
"transformers/module/es2015.ts",
74-
"transformers/module/system.ts",
75-
"transformers/module/module.ts",
7673
"transformers/jsx.ts",
7774
"transformers/es2017.ts",
7875
"transformers/es2016.ts",
7976
"transformers/es2015.ts",
8077
"transformers/generators.ts",
8178
"transformers/es5.ts",
79+
"transformers/module/es2015.ts",
80+
"transformers/module/system.ts",
81+
"transformers/module/module.ts",
8282
"transformer.ts",
8383
"sourcemap.ts",
8484
"comments.ts",
@@ -106,15 +106,15 @@ var servicesSources = [
106106
"visitor.ts",
107107
"transformers/destructuring.ts",
108108
"transformers/ts.ts",
109-
"transformers/module/es2015.ts",
110-
"transformers/module/system.ts",
111-
"transformers/module/module.ts",
112109
"transformers/jsx.ts",
113110
"transformers/es2017.ts",
114111
"transformers/es2016.ts",
115112
"transformers/es2015.ts",
116113
"transformers/generators.ts",
117114
"transformers/es5.ts",
115+
"transformers/module/es2015.ts",
116+
"transformers/module/system.ts",
117+
"transformers/module/module.ts",
118118
"transformer.ts",
119119
"sourcemap.ts",
120120
"comments.ts",

src/compiler/binder.ts

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,8 @@ namespace ts {
499499
const saveReturnTarget = currentReturnTarget;
500500
const saveActiveLabels = activeLabels;
501501
const saveHasExplicitReturn = hasExplicitReturn;
502-
const isIIFE = containerFlags & ContainerFlags.IsFunctionExpression && !!getImmediatelyInvokedFunctionExpression(node);
503-
// An IIFE is considered part of the containing control flow. Return statements behave
502+
const isIIFE = containerFlags & ContainerFlags.IsFunctionExpression && !hasModifier(node, ModifierFlags.Async) && !!getImmediatelyInvokedFunctionExpression(node);
503+
// A non-async IIFE is considered part of the containing control flow. Return statements behave
504504
// similarly to break statements that exit to a label just past the statement body.
505505
if (isIIFE) {
506506
currentReturnTarget = createBranchLabel();
@@ -892,8 +892,13 @@ namespace ts {
892892

893893
function bindDoStatement(node: DoStatement): void {
894894
const preDoLabel = createLoopLabel();
895-
const preConditionLabel = createBranchLabel();
896-
const postDoLabel = createBranchLabel();
895+
const enclosingLabeledStatement = node.parent.kind === SyntaxKind.LabeledStatement
896+
? lastOrUndefined(activeLabels)
897+
: undefined;
898+
// if do statement is wrapped in labeled statement then target labels for break/continue with or without
899+
// label should be the same
900+
const preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel();
901+
const postDoLabel = enclosingLabeledStatement ? enclosingLabeledStatement.breakTarget : createBranchLabel();
897902
addAntecedent(preDoLabel, currentFlow);
898903
currentFlow = preDoLabel;
899904
bindIterativeStatement(node.statement, postDoLabel, preConditionLabel);
@@ -1111,8 +1116,11 @@ namespace ts {
11111116
if (!activeLabel.referenced && !options.allowUnusedLabels) {
11121117
file.bindDiagnostics.push(createDiagnosticForNode(node.label, Diagnostics.Unused_label));
11131118
}
1114-
addAntecedent(postStatementLabel, currentFlow);
1115-
currentFlow = finishFlowLabel(postStatementLabel);
1119+
if (!node.statement || node.statement.kind !== SyntaxKind.DoStatement) {
1120+
// do statement sets current flow inside bindDoStatement
1121+
addAntecedent(postStatementLabel, currentFlow);
1122+
currentFlow = finishFlowLabel(postStatementLabel);
1123+
}
11161124
}
11171125

11181126
function bindDestructuringTargetFlow(node: Expression) {
@@ -2534,7 +2542,7 @@ namespace ts {
25342542
&& (leftKind === SyntaxKind.ObjectLiteralExpression
25352543
|| leftKind === SyntaxKind.ArrayLiteralExpression)) {
25362544
// Destructuring assignments are ES6 syntax.
2537-
transformFlags |= TransformFlags.AssertES2015 | TransformFlags.DestructuringAssignment;
2545+
transformFlags |= TransformFlags.AssertES2015 | TransformFlags.AssertDestructuringAssignment;
25382546
}
25392547
else if (operatorTokenKind === SyntaxKind.AsteriskAsteriskToken
25402548
|| operatorTokenKind === SyntaxKind.AsteriskAsteriskEqualsToken) {
@@ -2615,9 +2623,9 @@ namespace ts {
26152623

26162624
// A class with a parameter property assignment, property initializer, or decorator is
26172625
// TypeScript syntax.
2618-
// An exported declaration may be TypeScript syntax.
2626+
// An exported declaration may be TypeScript syntax, but is handled by the visitor
2627+
// for a namespace declaration.
26192628
if ((subtreeFlags & TransformFlags.TypeScriptClassSyntaxMask)
2620-
|| (modifierFlags & ModifierFlags.Export)
26212629
|| node.typeParameters) {
26222630
transformFlags |= TransformFlags.AssertTypeScript;
26232631
}
@@ -2787,11 +2795,6 @@ namespace ts {
27872795
else {
27882796
transformFlags = subtreeFlags | TransformFlags.ContainsHoistedDeclarationOrCompletion;
27892797

2790-
// If a FunctionDeclaration is exported, then it is either ES6 or TypeScript syntax.
2791-
if (modifierFlags & ModifierFlags.Export) {
2792-
transformFlags |= TransformFlags.AssertTypeScript | TransformFlags.AssertES2015;
2793-
}
2794-
27952798
// TypeScript-specific modifiers, type parameters, and type annotations are TypeScript
27962799
// syntax.
27972800
if (modifierFlags & ModifierFlags.TypeScriptModifier
@@ -2933,11 +2936,6 @@ namespace ts {
29332936
else {
29342937
transformFlags = subtreeFlags;
29352938

2936-
// If a VariableStatement is exported, then it is either ES6 or TypeScript syntax.
2937-
if (modifierFlags & ModifierFlags.Export) {
2938-
transformFlags |= TransformFlags.AssertES2015 | TransformFlags.AssertTypeScript;
2939-
}
2940-
29412939
if (declarationListTransformFlags & TransformFlags.ContainsBindingPattern) {
29422940
transformFlags |= TransformFlags.AssertES2015;
29432941
}
@@ -3054,12 +3052,6 @@ namespace ts {
30543052
transformFlags |= TransformFlags.AssertJsx;
30553053
break;
30563054

3057-
case SyntaxKind.ExportKeyword:
3058-
// This node is both ES6 and TypeScript syntax.
3059-
transformFlags |= TransformFlags.AssertES2015 | TransformFlags.AssertTypeScript;
3060-
break;
3061-
3062-
case SyntaxKind.DefaultKeyword:
30633055
case SyntaxKind.NoSubstitutionTemplateLiteral:
30643056
case SyntaxKind.TemplateHead:
30653057
case SyntaxKind.TemplateMiddle:
@@ -3068,6 +3060,7 @@ namespace ts {
30683060
case SyntaxKind.TaggedTemplateExpression:
30693061
case SyntaxKind.ShorthandPropertyAssignment:
30703062
case SyntaxKind.ForOfStatement:
3063+
case SyntaxKind.StaticKeyword:
30713064
// These nodes are ES6 syntax.
30723065
transformFlags |= TransformFlags.AssertES2015;
30733066
break;

0 commit comments

Comments
 (0)