diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 93d0bed9d7a..0d067b7f00d 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -1750,7 +1750,16 @@ namespace ts { name: "typescript:values", scoped: false, text: ` - var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; + var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + }; ` }; @@ -1764,52 +1773,24 @@ namespace ts { ); } - const stepHelper: EmitHelper = { - name: "typescript:step", - scoped: false, - text: ` - var __step = (this && this.__step) || function (r) { return !(r.done || (r.done = (r.result = r.iterator.next()).done)); }; - ` - }; - - export function createStepHelper(context: TransformationContext, iteratorRecord: Expression, location?: TextRange) { - context.requestEmitHelper(stepHelper); - return createCall( - getHelperName("__step"), - /*typeArguments*/ undefined, - [iteratorRecord], - location - ); - } - - const closeHelper: EmitHelper = { - name: "typescript:close", - scoped: false, - text: ` - var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; - ` - }; - - export function createCloseHelper(context: TransformationContext, iteratorRecord: Expression, location?: TextRange) { - context.requestEmitHelper(closeHelper); - return createCall( - getHelperName("__close"), - /*typeArguments*/ undefined, - [iteratorRecord], - location - ); - } - const readHelper: EmitHelper = { name: "typescript:read", scoped: false, text: ` var __read = (this && this.__read) || function (o, n) { - if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; - var m, i = m.call(o), ar = [], r, e; - try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { e = { error: error }; } - finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } return ar; }; ` diff --git a/src/compiler/transformers/es2015.ts b/src/compiler/transformers/es2015.ts index 190ac0023c4..80bcc94cbc0 100644 --- a/src/compiler/transformers/es2015.ts +++ b/src/compiler/transformers/es2015.ts @@ -2202,7 +2202,8 @@ namespace ts { compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray); } - function convertForOfStatementHead(statements: Statement[], node: ForOfStatement, boundValue: Expression, convertedLoopBodyStatements: Statement[]) { + function convertForOfStatementHead(node: ForOfStatement, boundValue: Expression, convertedLoopBodyStatements: Statement[]) { + const statements: Statement[] = []; if (isVariableDeclarationList(node.initializer)) { if (node.initializer.flags & NodeFlags.BlockScoped) { enableSubstitutionsForBlockScopedBindings(); @@ -2291,72 +2292,16 @@ namespace ts { } } - return { bodyLocation, statementsLocation }; - } - - function convertForOfStatementForIterable(node: ForOfStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]): Statement { - const expression = visitNode(node.expression, visitor, isExpression); - const iteratorRecord = isIdentifier(node.expression) - ? getGeneratedNameForNode(node.expression) - : createUniqueName("iterator"); - - const statements: Statement[] = []; - const { bodyLocation, statementsLocation } = convertForOfStatementHead( - statements, - node, - createPropertyAccess( - createPropertyAccess(iteratorRecord, "result"), - "value" + // The old emitter does not emit source maps for the block. + // We add the location to preserve comments. + return setEmitFlags( + createBlock( + createNodeArray(statements, /*location*/ statementsLocation), + /*location*/ bodyLocation, + /*multiLine*/ true ), - convertedLoopBodyStatements); - - let statement: Statement = setEmitFlags( - createFor( - createVariableDeclarationList( - [ - createVariableDeclaration( - iteratorRecord, - /*type*/ undefined, - createObjectLiteral( - [ - createPropertyAssignment( - "iterator", - createValuesHelper( - context, - expression, - node.expression - ), - node.expression - ) - ], - node.expression - ), - node.expression - ) - ], - node.expression - ), - /*condition*/ createStepHelper( - context, - iteratorRecord, - node.initializer - ), - /*incrementor*/ undefined, - setEmitFlags( - createBlock( - createNodeArray(statements, statementsLocation), - bodyLocation, - /*multiLine*/ true - ), - EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps - ), - /*location*/ node - ), - EmitFlags.NoTokenTrailingSourceMaps + EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps ); - - statement = restoreEnclosingLabel(statement, outermostLabeledStatement); - return closeIterator(statement, iteratorRecord); } function convertForOfStatementForArray(node: ForOfStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]): Statement { @@ -2382,7 +2327,6 @@ namespace ts { // for-of bodies are always emitted as blocks. const expression = visitNode(node.expression, visitor, isExpression); - const statements: Statement[] = []; // In the case where the user wrote an identifier as the RHS, like this: // @@ -2390,43 +2334,30 @@ namespace ts { // // we don't want to emit a temporary variable for the RHS, just use it directly. const counter = createLoopVariable(); - const rhsReference = expression.kind === SyntaxKind.Identifier - ? createUniqueName((expression).text) - : createTempVariable(/*recordTempVariable*/ undefined); - - const { bodyLocation, statementsLocation } = convertForOfStatementHead( - statements, - node, - createElementAccess(rhsReference, counter), - convertedLoopBodyStatements); + const rhsReference = isIdentifier(expression) ? getGeneratedNameForNode(expression) : createTempVariable(/*recordTempVariable*/ undefined); // The old emitter does not emit source maps for the expression setEmitFlags(expression, EmitFlags.NoSourceMap | getEmitFlags(expression)); - // The old emitter does not emit source maps for the block. - // We add the location to preserve comments. - const body = createBlock( - createNodeArray(statements, /*location*/ statementsLocation), - /*location*/ bodyLocation - ); - - setEmitFlags(body, EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps); - const forStatement = createFor( - setEmitFlags( + /*initializer*/ setEmitFlags( createVariableDeclarationList([ createVariableDeclaration(counter, /*type*/ undefined, createLiteral(0), /*location*/ moveRangePos(node.expression, -1)), createVariableDeclaration(rhsReference, /*type*/ undefined, expression, /*location*/ node.expression) ], /*location*/ node.expression), EmitFlags.NoHoisting ), - createLessThan( + /*condition*/ createLessThan( counter, createPropertyAccess(rhsReference, "length"), /*location*/ node.expression ), - createPostfixIncrement(counter, /*location*/ node.expression), - body, + /*incrementor*/ createPostfixIncrement(counter, /*location*/ node.expression), + /*statement*/ convertForOfStatementHead( + node, + createElementAccess(rhsReference, counter), + convertedLoopBodyStatements + ), /*location*/ node ); @@ -2435,14 +2366,47 @@ namespace ts { return restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel); } - function closeIterator(statement: Statement, iteratorRecord: Expression) { + function convertForOfStatementForIterable(node: ForOfStatement, outermostLabeledStatement: LabeledStatement, convertedLoopBodyStatements: Statement[]): Statement { + const expression = visitNode(node.expression, visitor, isExpression); + const iterator = isIdentifier(expression) ? getGeneratedNameForNode(expression) : createTempVariable(/*recordTempVariable*/ undefined); + const result = isIdentifier(expression) ? getGeneratedNameForNode(iterator) : createTempVariable(/*recordTempVariable*/ undefined); const errorRecord = createUniqueName("e"); - hoistVariableDeclaration(errorRecord); const catchVariable = getGeneratedNameForNode(errorRecord); + const returnMethod = createTempVariable(/*recordTempVariable*/ undefined); + const values = createValuesHelper(context, expression, node.expression); + const next = createCall(createPropertyAccess(iterator, "next" ), /*typeArguments*/ undefined, []); + + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); + + const forStatement = setEmitFlags( + createFor( + /*initializer*/ setEmitFlags( + createVariableDeclarationList([ + createVariableDeclaration(iterator, /*type*/ undefined, values, /*location*/ node.expression), + createVariableDeclaration(result, /*type*/ undefined, next) + ], /*location*/ node.expression), + EmitFlags.NoHoisting + ), + /*condition*/ createLogicalNot(createPropertyAccess(result, "done")), + /*incrementor*/ createAssignment(result, next), + /*statement*/ convertForOfStatementHead( + node, + createPropertyAccess(result, "value"), + convertedLoopBodyStatements + ), + /*location*/ node + ), + EmitFlags.NoTokenTrailingSourceMaps + ); return createTry( createBlock([ - statement + restoreEnclosingLabel( + forStatement, + outermostLabeledStatement, + convertedLoopState && resetLabel + ) ]), createCatchClause(catchVariable, setEmitFlags( @@ -2451,10 +2415,7 @@ namespace ts { createAssignment( errorRecord, createObjectLiteral([ - createPropertyAssignment( - "error", - catchVariable - ) + createPropertyAssignment("error", catchVariable) ]) ) ) @@ -2463,39 +2424,44 @@ namespace ts { ) ), createBlock([ - setEmitFlags( - createTry( + createTry( + /*tryBlock*/ createBlock([ setEmitFlags( - createBlock([ - createStatement( - createCloseHelper( - context, - iteratorRecord - ) - ) - ]), - EmitFlags.SingleLine - ), - undefined, - setEmitFlags( - createBlock([ - setEmitFlags( - createIf( - errorRecord, - createThrow( - createPropertyAccess( - errorRecord, - "error" - ) + createIf( + createLogicalAnd( + createLogicalAnd( + result, + createLogicalNot( + createPropertyAccess(result, "done") ) ), - EmitFlags.SingleLine + createAssignment( + returnMethod, + createPropertyAccess(iterator, "return") + ) + ), + createStatement( + createFunctionCall(returnMethod, iterator, []) ) - ]), + ), EmitFlags.SingleLine - ) - ), - EmitFlags.SingleLine + ), + ]), + /*catchClause*/ undefined, + /*finallyBlock*/ setEmitFlags( + createBlock([ + setEmitFlags( + createIf( + errorRecord, + createThrow( + createPropertyAccess(errorRecord, "error") + ) + ), + EmitFlags.SingleLine + ) + ]), + EmitFlags.SingleLine + ) ) ]) ); diff --git a/src/compiler/transformers/esnext.ts b/src/compiler/transformers/esnext.ts index 676251691ae..5685b7ba3c3 100644 --- a/src/compiler/transformers/esnext.ts +++ b/src/compiler/transformers/esnext.ts @@ -312,18 +312,8 @@ namespace ts { return node; } - function transformForAwaitOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement) { - const iteratorRecord = isIdentifier(node.expression) - ? getGeneratedNameForNode(node.expression) - : createUniqueName("iterator"); - const expression = visitNode(node.expression, visitor, isExpression); - const binding = createForOfBindingStatement( - node.initializer, - createPropertyAccess( - createPropertyAccess(iteratorRecord, "result"), - "value" - ) - ); + function convertForOfStatementHead(node: ForOfStatement, boundValue: Expression) { + const binding = createForOfBindingStatement(node.initializer, boundValue); let bodyLocation: TextRange; let statementsLocation: TextRange; @@ -338,79 +328,58 @@ namespace ts { statements.push(statement); } - const step = createAsyncStepHelper( - context, - iteratorRecord, - node.initializer + return setEmitFlags( + createBlock( + createNodeArray(statements, statementsLocation), + bodyLocation, + /*multiLine*/ true + ), + EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps ); + } + + function transformForAwaitOfStatement(node: ForOfStatement, outermostLabeledStatement: LabeledStatement) { + const expression = visitNode(node.expression, visitor, isExpression); + const iterator = isIdentifier(expression) ? getGeneratedNameForNode(expression) : createTempVariable(/*recordTempVariable*/ undefined); + const result = isIdentifier(expression) ? getGeneratedNameForNode(iterator) : createTempVariable(/*recordTempVariable*/ undefined); + const errorRecord = createUniqueName("e"); + const catchVariable = getGeneratedNameForNode(errorRecord); + const returnMethod = createTempVariable(/*recordTempVariable*/ undefined); + const values = createAsyncValuesHelper(context, expression, /*location*/ node.expression); + const next = createYield( + /*asteriskToken*/ undefined, + createArrayLiteral([ + createLiteral("await"), + createCall(createPropertyAccess(iterator, "next" ), /*typeArguments*/ undefined, []) + ]) + ); + + hoistVariableDeclaration(errorRecord); + hoistVariableDeclaration(returnMethod); const forStatement = setEmitFlags( createFor( - createVariableDeclarationList( - [ - createVariableDeclaration( - iteratorRecord, - /*type*/ undefined, - createObjectLiteral( - [ - createPropertyAssignment( - "iterator", - createAsyncValuesHelper( - context, - expression, - node.expression - ), - node.expression - ) - ], - node.expression - ), - node.expression - ) - ], - node.expression - ), - /*condition*/ createYield( - /*asteriskToken*/ undefined, - enclosingFunctionFlags & FunctionFlags.Generator ? - createArrayLiteral([createLiteral("await"), step]) : - step, - node.initializer - ), - /*incrementor*/ undefined, - setEmitFlags( - createBlock( - createNodeArray(statements, statementsLocation), - bodyLocation, - /*multiLine*/ true - ), - EmitFlags.NoSourceMap | EmitFlags.NoTokenSourceMaps + /*initializer*/ setEmitFlags( + createVariableDeclarationList([ + createVariableDeclaration(iterator, /*type*/ undefined, values, node.expression), + createVariableDeclaration(result, /*type*/ undefined, next) + ], /*location*/ node.expression), + EmitFlags.NoHoisting ), + /*condition*/ createLogicalNot(createPropertyAccess(result, "done")), + /*incrementor*/ createAssignment(result, next), + /*statement*/ convertForOfStatementHead(node, createPropertyAccess(result, "value")), /*location*/ node ), EmitFlags.NoTokenTrailingSourceMaps ); - return closeAsyncIterator( - restoreEnclosingLabel( - forStatement, - outermostLabeledStatement - ), - iteratorRecord - ); - } - - function closeAsyncIterator(statement: Statement, iteratorRecord: Expression) { - const errorRecord = createUniqueName("e"); - hoistVariableDeclaration(errorRecord); - const catchVariable = getGeneratedNameForNode(errorRecord); - const close = createCloseHelper( - context, - iteratorRecord - ); return createTry( createBlock([ - statement + restoreEnclosingLabel( + forStatement, + outermostLabeledStatement + ) ]), createCatchClause(catchVariable, setEmitFlags( @@ -419,10 +388,7 @@ namespace ts { createAssignment( errorRecord, createObjectLiteral([ - createPropertyAssignment( - "error", - catchVariable - ) + createPropertyAssignment("error", catchVariable) ]) ) ) @@ -431,41 +397,50 @@ namespace ts { ) ), createBlock([ - setEmitFlags( - createTry( + createTry( + /*tryBlock*/ createBlock([ setEmitFlags( - createBlock([ + createIf( + createLogicalAnd( + createLogicalAnd( + result, + createLogicalNot( + createPropertyAccess(result, "done") + ) + ), + createAssignment( + returnMethod, + createPropertyAccess(iterator, "return") + ) + ), createStatement( createYield( /*asteriskToken*/ undefined, - enclosingFunctionFlags & FunctionFlags.Generator ? - createArrayLiteral([createLiteral("await"), close]) : - close + createArrayLiteral([ + createLiteral("await"), + createFunctionCall(returnMethod, iterator, []) + ]) ) ) - ]), - EmitFlags.SingleLine - ), - undefined, - setEmitFlags( - createBlock([ - setEmitFlags( - createIf( - errorRecord, - createThrow( - createPropertyAccess( - errorRecord, - "error" - ) - ) - ), - EmitFlags.SingleLine - ) - ]), + ), EmitFlags.SingleLine ) - ), - EmitFlags.SingleLine + ]), + /*catchClause*/ undefined, + /*finallyBlock*/ setEmitFlags( + createBlock([ + setEmitFlags( + createIf( + errorRecord, + createThrow( + createPropertyAccess(errorRecord, "error") + ) + ), + EmitFlags.SingleLine + ) + ]), + EmitFlags.SingleLine + ) ) ]) ); @@ -907,7 +882,11 @@ namespace ts { name: "typescript:asyncValues", scoped: false, text: ` - var __asyncValues = (this && this.__asyncIterator) || function (o) { return (m = o[Symbol.asyncIterator]) ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); var m; }; + var __asyncValues = (this && this.__asyncIterator) || function (o) { + var m = o[Symbol.asyncIterator]; + if (m) return m.call(o); + return typeof __values === "function" ? __values(o) : o[Symbol.iterator](); + }; ` }; @@ -942,22 +921,4 @@ namespace ts { location ); } - - const asyncStep: EmitHelper = { - name: "typescript:asyncStep", - scoped: false, - text: ` - var __asyncStep = (this && this.__asyncStep) || function (r) { return !r.done && Promise.resolve(r.iterator.next()).then(function (_) { return !(r.done = (r.result = _).done); }); }; - ` - }; - - function createAsyncStepHelper(context: TransformationContext, iteratorRecord: Expression, location?: TextRange) { - context.requestEmitHelper(asyncStep); - return createCall( - getHelperName("__asyncStep"), - /*typeArguments*/ undefined, - [iteratorRecord], - location - ); - } } diff --git a/tests/baselines/reference/ES5For-of33.js b/tests/baselines/reference/ES5For-of33.js index 205fd29e878..729c37b8120 100644 --- a/tests/baselines/reference/ES5For-of33.js +++ b/tests/baselines/reference/ES5For-of33.js @@ -4,18 +4,28 @@ for (var v of ['a', 'b', 'c']) { } //// [ES5For-of33.js] -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; -var __step = (this && this.__step) || function (r) { return !(r.done || (r.done = (r.result = r.iterator.next()).done)); }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; try { - for (var iterator_1 = { iterator: __values(['a', 'b', 'c']) }; __step(iterator_1);) { - var v = iterator_1.result.value; + for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) { + var v = _b.value; console.log(v); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { - try { __close(iterator_1); } finally { if (e_1) throw e_1.error; } + try { + if (_b && !_b.done && (_c = _a["return"])) _c.call(_a); + } + finally { if (e_1) throw e_1.error; } } -var e_1; +var e_1, _c; //# sourceMappingURL=ES5For-of33.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of33.js.map b/tests/baselines/reference/ES5For-of33.js.map index 3ba7af63150..5d5969b4585 100644 --- a/tests/baselines/reference/ES5For-of33.js.map +++ b/tests/baselines/reference/ES5For-of33.js.map @@ -1,2 +1,2 @@ //// [ES5For-of33.js.map] -{"version":3,"file":"ES5For-of33.js","sourceRoot":"","sources":["ES5For-of33.ts"],"names":[],"mappings":";;;;IAAA,GAAG,CAAC,CAAU,IAAA,aAAA,EAAA,UAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,EAAA,EAAxB,kBAAK;QAAL,IAAI,CAAC,0BAAA;QACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAClB"} \ No newline at end of file +{"version":3,"file":"ES5For-of33.js","sourceRoot":"","sources":["ES5For-of33.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,GAAG,CAAC,CAAU,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA;QAAxB,IAAI,CAAC,WAAA;QACN,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAClB"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of33.sourcemap.txt b/tests/baselines/reference/ES5For-of33.sourcemap.txt index 37e16006d3b..12dd243cf0e 100644 --- a/tests/baselines/reference/ES5For-of33.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of33.sourcemap.txt @@ -8,85 +8,80 @@ sources: ES5For-of33.ts emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of33.js sourceFile:ES5For-of33.ts ------------------------------------------------------------------- ->>>var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; ->>>var __step = (this && this.__step) || function (r) { return !(r.done || (r.done = (r.result = r.iterator.next()).done)); }; ->>>var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +>>>var __values = (this && this.__values) || function (o) { +>>> var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +>>> if (m) return m.call(o); +>>> return { +>>> next: function () { +>>> if (o && i >= o.length) o = void 0; +>>> return { value: o && o[i++], done: !o }; +>>> } +>>> }; +>>>}; >>>try { ->>> for (var iterator_1 = { iterator: __values(['a', 'b', 'c']) }; __step(iterator_1);) { +>>> for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) { 1 >^^^^ 2 > ^^^ 3 > ^ 4 > ^ 5 > ^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^ -8 > ^^^^^^^^^^ -9 > ^^^^^^^^^ -10> ^ -11> ^^^ -12> ^^ -13> ^^^ -14> ^^ -15> ^^^ -16> ^ -17> ^ -18> ^^ -19> ^^ -20> ^^^^^^^^^^^^^^^^^^ +6 > ^^^^^ +7 > ^^^^^^^^^ +8 > ^ +9 > ^^^ +10> ^^ +11> ^^^ +12> ^^ +13> ^^^ +14> ^ +15> ^ +16> ^^^^^^^^^^^^^^^^ 1 > 2 > for 3 > 4 > (var v of 5 > 6 > -7 > -8 > -9 > -10> [ -11> 'a' -12> , -13> 'b' -14> , -15> 'c' -16> ] -17> -18> -19> -20> var v -1 >Emitted(5, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(5, 8) Source(1, 4) + SourceIndex(0) -3 >Emitted(5, 9) Source(1, 5) + SourceIndex(0) -4 >Emitted(5, 10) Source(1, 15) + SourceIndex(0) -5 >Emitted(5, 14) Source(1, 15) + SourceIndex(0) -6 >Emitted(5, 27) Source(1, 15) + SourceIndex(0) -7 >Emitted(5, 29) Source(1, 15) + SourceIndex(0) -8 >Emitted(5, 39) Source(1, 15) + SourceIndex(0) -9 >Emitted(5, 48) Source(1, 15) + SourceIndex(0) -10>Emitted(5, 49) Source(1, 16) + SourceIndex(0) -11>Emitted(5, 52) Source(1, 19) + SourceIndex(0) -12>Emitted(5, 54) Source(1, 21) + SourceIndex(0) -13>Emitted(5, 57) Source(1, 24) + SourceIndex(0) -14>Emitted(5, 59) Source(1, 26) + SourceIndex(0) -15>Emitted(5, 62) Source(1, 29) + SourceIndex(0) -16>Emitted(5, 63) Source(1, 30) + SourceIndex(0) -17>Emitted(5, 64) Source(1, 30) + SourceIndex(0) -18>Emitted(5, 66) Source(1, 30) + SourceIndex(0) -19>Emitted(5, 68) Source(1, 6) + SourceIndex(0) -20>Emitted(5, 86) Source(1, 11) + SourceIndex(0) +7 > +8 > [ +9 > 'a' +10> , +11> 'b' +12> , +13> 'c' +14> ] +15> +16> +1 >Emitted(12, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(12, 8) Source(1, 4) + SourceIndex(0) +3 >Emitted(12, 9) Source(1, 5) + SourceIndex(0) +4 >Emitted(12, 10) Source(1, 15) + SourceIndex(0) +5 >Emitted(12, 14) Source(1, 15) + SourceIndex(0) +6 >Emitted(12, 19) Source(1, 15) + SourceIndex(0) +7 >Emitted(12, 28) Source(1, 15) + SourceIndex(0) +8 >Emitted(12, 29) Source(1, 16) + SourceIndex(0) +9 >Emitted(12, 32) Source(1, 19) + SourceIndex(0) +10>Emitted(12, 34) Source(1, 21) + SourceIndex(0) +11>Emitted(12, 37) Source(1, 24) + SourceIndex(0) +12>Emitted(12, 39) Source(1, 26) + SourceIndex(0) +13>Emitted(12, 42) Source(1, 29) + SourceIndex(0) +14>Emitted(12, 43) Source(1, 30) + SourceIndex(0) +15>Emitted(12, 44) Source(1, 30) + SourceIndex(0) +16>Emitted(12, 60) Source(1, 30) + SourceIndex(0) --- ->>> var v = iterator_1.result.value; +>>> var v = _b.value; 1 >^^^^^^^^ 2 > ^^^^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^ 1 > 2 > var 3 > v 4 > -1 >Emitted(6, 9) Source(1, 6) + SourceIndex(0) -2 >Emitted(6, 13) Source(1, 10) + SourceIndex(0) -3 >Emitted(6, 14) Source(1, 11) + SourceIndex(0) -4 >Emitted(6, 40) Source(1, 11) + SourceIndex(0) +1 >Emitted(13, 9) Source(1, 6) + SourceIndex(0) +2 >Emitted(13, 13) Source(1, 10) + SourceIndex(0) +3 >Emitted(13, 14) Source(1, 11) + SourceIndex(0) +4 >Emitted(13, 25) Source(1, 11) + SourceIndex(0) --- >>> console.log(v); 1 >^^^^^^^^ @@ -106,25 +101,28 @@ sourceFile:ES5For-of33.ts 6 > v 7 > ) 8 > ; -1 >Emitted(7, 9) Source(2, 5) + SourceIndex(0) -2 >Emitted(7, 16) Source(2, 12) + SourceIndex(0) -3 >Emitted(7, 17) Source(2, 13) + SourceIndex(0) -4 >Emitted(7, 20) Source(2, 16) + SourceIndex(0) -5 >Emitted(7, 21) Source(2, 17) + SourceIndex(0) -6 >Emitted(7, 22) Source(2, 18) + SourceIndex(0) -7 >Emitted(7, 23) Source(2, 19) + SourceIndex(0) -8 >Emitted(7, 24) Source(2, 20) + SourceIndex(0) +1 >Emitted(14, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(14, 16) Source(2, 12) + SourceIndex(0) +3 >Emitted(14, 17) Source(2, 13) + SourceIndex(0) +4 >Emitted(14, 20) Source(2, 16) + SourceIndex(0) +5 >Emitted(14, 21) Source(2, 17) + SourceIndex(0) +6 >Emitted(14, 22) Source(2, 18) + SourceIndex(0) +7 >Emitted(14, 23) Source(2, 19) + SourceIndex(0) +8 >Emitted(14, 24) Source(2, 20) + SourceIndex(0) --- >>> } 1 >^^^^^ 1 > >} -1 >Emitted(8, 6) Source(3, 2) + SourceIndex(0) +1 >Emitted(15, 6) Source(3, 2) + SourceIndex(0) --- >>>} >>>catch (e_1_1) { e_1 = { error: e_1_1 }; } >>>finally { ->>> try { __close(iterator_1); } finally { if (e_1) throw e_1.error; } +>>> try { +>>> if (_b && !_b.done && (_c = _a["return"])) _c.call(_a); +>>> } +>>> finally { if (e_1) throw e_1.error; } >>>} ->>>var e_1; +>>>var e_1, _c; >>>//# sourceMappingURL=ES5For-of33.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.js b/tests/baselines/reference/ES5For-of34.js index 0ad5a2793d3..307a7505d09 100644 --- a/tests/baselines/reference/ES5For-of34.js +++ b/tests/baselines/reference/ES5For-of34.js @@ -7,21 +7,31 @@ for (foo().x of ['a', 'b', 'c']) { } //// [ES5For-of34.js] -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; -var __step = (this && this.__step) || function (r) { return !(r.done || (r.done = (r.result = r.iterator.next()).done)); }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; function foo() { return { x: 0 }; } try { - for (var iterator_1 = { iterator: __values(['a', 'b', 'c']) }; __step(iterator_1);) { - foo().x = iterator_1.result.value; + for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) { + foo().x = _b.value; var p = foo().x; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { - try { __close(iterator_1); } finally { if (e_1) throw e_1.error; } + try { + if (_b && !_b.done && (_c = _a["return"])) _c.call(_a); + } + finally { if (e_1) throw e_1.error; } } -var e_1; +var e_1, _c; //# sourceMappingURL=ES5For-of34.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.js.map b/tests/baselines/reference/ES5For-of34.js.map index 44d10b261b7..041fda734b5 100644 --- a/tests/baselines/reference/ES5For-of34.js.map +++ b/tests/baselines/reference/ES5For-of34.js.map @@ -1,2 +1,2 @@ //// [ES5For-of34.js.map] -{"version":3,"file":"ES5For-of34.js","sourceRoot":"","sources":["ES5For-of34.ts"],"names":[],"mappings":";;;AAAA;IACI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;;IACD,GAAG,CAAC,CAAY,IAAA,aAAA,EAAA,UAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,EAAA,EAA1B,kBAAO;QAAP,GAAG,EAAE,CAAC,CAAC,0BAAA;QACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;KACnB"} \ No newline at end of file +{"version":3,"file":"ES5For-of34.js","sourceRoot":"","sources":["ES5For-of34.ts"],"names":[],"mappings":";;;;;;;;;;AAAA;IACI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;;IACD,GAAG,CAAC,CAAY,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA;QAA1B,GAAG,EAAE,CAAC,CAAC,WAAA;QACR,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;KACnB"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of34.sourcemap.txt b/tests/baselines/reference/ES5For-of34.sourcemap.txt index 6d2d7724745..540d52cc581 100644 --- a/tests/baselines/reference/ES5For-of34.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of34.sourcemap.txt @@ -8,14 +8,21 @@ sources: ES5For-of34.ts emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of34.js sourceFile:ES5For-of34.ts ------------------------------------------------------------------- ->>>var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; ->>>var __step = (this && this.__step) || function (r) { return !(r.done || (r.done = (r.result = r.iterator.next()).done)); }; ->>>var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +>>>var __values = (this && this.__values) || function (o) { +>>> var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +>>> if (m) return m.call(o); +>>> return { +>>> next: function () { +>>> if (o && i >= o.length) o = void 0; +>>> return { value: o && o[i++], done: !o }; +>>> } +>>> }; +>>>}; >>>function foo() { 1 > 2 >^^^^^^^^^^^^^^^^^^^^^-> 1 > -1 >Emitted(4, 1) Source(1, 1) + SourceIndex(0) +1 >Emitted(11, 1) Source(1, 1) + SourceIndex(0) --- >>> return { x: 0 }; 1->^^^^ @@ -37,15 +44,15 @@ sourceFile:ES5For-of34.ts 7 > 0 8 > } 9 > ; -1->Emitted(5, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(5, 11) Source(2, 11) + SourceIndex(0) -3 >Emitted(5, 12) Source(2, 12) + SourceIndex(0) -4 >Emitted(5, 14) Source(2, 14) + SourceIndex(0) -5 >Emitted(5, 15) Source(2, 15) + SourceIndex(0) -6 >Emitted(5, 17) Source(2, 17) + SourceIndex(0) -7 >Emitted(5, 18) Source(2, 18) + SourceIndex(0) -8 >Emitted(5, 20) Source(2, 20) + SourceIndex(0) -9 >Emitted(5, 21) Source(2, 21) + SourceIndex(0) +1->Emitted(12, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(12, 11) Source(2, 11) + SourceIndex(0) +3 >Emitted(12, 12) Source(2, 12) + SourceIndex(0) +4 >Emitted(12, 14) Source(2, 14) + SourceIndex(0) +5 >Emitted(12, 15) Source(2, 15) + SourceIndex(0) +6 >Emitted(12, 17) Source(2, 17) + SourceIndex(0) +7 >Emitted(12, 18) Source(2, 18) + SourceIndex(0) +8 >Emitted(12, 20) Source(2, 20) + SourceIndex(0) +9 >Emitted(12, 21) Source(2, 21) + SourceIndex(0) --- >>>} 1 > @@ -54,31 +61,27 @@ sourceFile:ES5For-of34.ts 1 > > 2 >} -1 >Emitted(6, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(6, 2) Source(3, 2) + SourceIndex(0) +1 >Emitted(13, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(13, 2) Source(3, 2) + SourceIndex(0) --- >>>try { ->>> for (var iterator_1 = { iterator: __values(['a', 'b', 'c']) }; __step(iterator_1);) { +>>> for (var _a = __values(['a', 'b', 'c']), _b = _a.next(); !_b.done; _b = _a.next()) { 1->^^^^ 2 > ^^^ 3 > ^ 4 > ^ 5 > ^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^ -8 > ^^^^^^^^^^ -9 > ^^^^^^^^^ -10> ^ -11> ^^^ -12> ^^ -13> ^^^ -14> ^^ -15> ^^^ -16> ^ -17> ^ -18> ^^ -19> ^^ -20> ^^^^^^^^^^^^^^^^^^ +6 > ^^^^^ +7 > ^^^^^^^^^ +8 > ^ +9 > ^^^ +10> ^^ +11> ^^^ +12> ^^ +13> ^^^ +14> ^ +15> ^ +16> ^^^^^^^^^^^^^^^^ 1-> > 2 > for @@ -86,60 +89,52 @@ sourceFile:ES5For-of34.ts 4 > (foo().x of 5 > 6 > -7 > -8 > -9 > -10> [ -11> 'a' -12> , -13> 'b' -14> , -15> 'c' -16> ] -17> -18> -19> -20> foo().x -1->Emitted(8, 5) Source(4, 1) + SourceIndex(0) -2 >Emitted(8, 8) Source(4, 4) + SourceIndex(0) -3 >Emitted(8, 9) Source(4, 5) + SourceIndex(0) -4 >Emitted(8, 10) Source(4, 17) + SourceIndex(0) -5 >Emitted(8, 14) Source(4, 17) + SourceIndex(0) -6 >Emitted(8, 27) Source(4, 17) + SourceIndex(0) -7 >Emitted(8, 29) Source(4, 17) + SourceIndex(0) -8 >Emitted(8, 39) Source(4, 17) + SourceIndex(0) -9 >Emitted(8, 48) Source(4, 17) + SourceIndex(0) -10>Emitted(8, 49) Source(4, 18) + SourceIndex(0) -11>Emitted(8, 52) Source(4, 21) + SourceIndex(0) -12>Emitted(8, 54) Source(4, 23) + SourceIndex(0) -13>Emitted(8, 57) Source(4, 26) + SourceIndex(0) -14>Emitted(8, 59) Source(4, 28) + SourceIndex(0) -15>Emitted(8, 62) Source(4, 31) + SourceIndex(0) -16>Emitted(8, 63) Source(4, 32) + SourceIndex(0) -17>Emitted(8, 64) Source(4, 32) + SourceIndex(0) -18>Emitted(8, 66) Source(4, 32) + SourceIndex(0) -19>Emitted(8, 68) Source(4, 6) + SourceIndex(0) -20>Emitted(8, 86) Source(4, 13) + SourceIndex(0) +7 > +8 > [ +9 > 'a' +10> , +11> 'b' +12> , +13> 'c' +14> ] +15> +16> +1->Emitted(15, 5) Source(4, 1) + SourceIndex(0) +2 >Emitted(15, 8) Source(4, 4) + SourceIndex(0) +3 >Emitted(15, 9) Source(4, 5) + SourceIndex(0) +4 >Emitted(15, 10) Source(4, 17) + SourceIndex(0) +5 >Emitted(15, 14) Source(4, 17) + SourceIndex(0) +6 >Emitted(15, 19) Source(4, 17) + SourceIndex(0) +7 >Emitted(15, 28) Source(4, 17) + SourceIndex(0) +8 >Emitted(15, 29) Source(4, 18) + SourceIndex(0) +9 >Emitted(15, 32) Source(4, 21) + SourceIndex(0) +10>Emitted(15, 34) Source(4, 23) + SourceIndex(0) +11>Emitted(15, 37) Source(4, 26) + SourceIndex(0) +12>Emitted(15, 39) Source(4, 28) + SourceIndex(0) +13>Emitted(15, 42) Source(4, 31) + SourceIndex(0) +14>Emitted(15, 43) Source(4, 32) + SourceIndex(0) +15>Emitted(15, 44) Source(4, 32) + SourceIndex(0) +16>Emitted(15, 60) Source(4, 32) + SourceIndex(0) --- ->>> foo().x = iterator_1.result.value; +>>> foo().x = _b.value; 1 >^^^^^^^^ 2 > ^^^ 3 > ^^ 4 > ^ 5 > ^ -6 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +6 > ^^^^^^^^^^^ 1 > 2 > foo 3 > () 4 > . 5 > x 6 > -1 >Emitted(9, 9) Source(4, 6) + SourceIndex(0) -2 >Emitted(9, 12) Source(4, 9) + SourceIndex(0) -3 >Emitted(9, 14) Source(4, 11) + SourceIndex(0) -4 >Emitted(9, 15) Source(4, 12) + SourceIndex(0) -5 >Emitted(9, 16) Source(4, 13) + SourceIndex(0) -6 >Emitted(9, 42) Source(4, 13) + SourceIndex(0) +1 >Emitted(16, 9) Source(4, 6) + SourceIndex(0) +2 >Emitted(16, 12) Source(4, 9) + SourceIndex(0) +3 >Emitted(16, 14) Source(4, 11) + SourceIndex(0) +4 >Emitted(16, 15) Source(4, 12) + SourceIndex(0) +5 >Emitted(16, 16) Source(4, 13) + SourceIndex(0) +6 >Emitted(16, 27) Source(4, 13) + SourceIndex(0) --- >>> var p = foo().x; 1 >^^^^^^^^ @@ -161,26 +156,29 @@ sourceFile:ES5For-of34.ts 7 > . 8 > x 9 > ; -1 >Emitted(10, 9) Source(5, 5) + SourceIndex(0) -2 >Emitted(10, 13) Source(5, 9) + SourceIndex(0) -3 >Emitted(10, 14) Source(5, 10) + SourceIndex(0) -4 >Emitted(10, 17) Source(5, 13) + SourceIndex(0) -5 >Emitted(10, 20) Source(5, 16) + SourceIndex(0) -6 >Emitted(10, 22) Source(5, 18) + SourceIndex(0) -7 >Emitted(10, 23) Source(5, 19) + SourceIndex(0) -8 >Emitted(10, 24) Source(5, 20) + SourceIndex(0) -9 >Emitted(10, 25) Source(5, 21) + SourceIndex(0) +1 >Emitted(17, 9) Source(5, 5) + SourceIndex(0) +2 >Emitted(17, 13) Source(5, 9) + SourceIndex(0) +3 >Emitted(17, 14) Source(5, 10) + SourceIndex(0) +4 >Emitted(17, 17) Source(5, 13) + SourceIndex(0) +5 >Emitted(17, 20) Source(5, 16) + SourceIndex(0) +6 >Emitted(17, 22) Source(5, 18) + SourceIndex(0) +7 >Emitted(17, 23) Source(5, 19) + SourceIndex(0) +8 >Emitted(17, 24) Source(5, 20) + SourceIndex(0) +9 >Emitted(17, 25) Source(5, 21) + SourceIndex(0) --- >>> } 1 >^^^^^ 1 > >} -1 >Emitted(11, 6) Source(6, 2) + SourceIndex(0) +1 >Emitted(18, 6) Source(6, 2) + SourceIndex(0) --- >>>} >>>catch (e_1_1) { e_1 = { error: e_1_1 }; } >>>finally { ->>> try { __close(iterator_1); } finally { if (e_1) throw e_1.error; } +>>> try { +>>> if (_b && !_b.done && (_c = _a["return"])) _c.call(_a); +>>> } +>>> finally { if (e_1) throw e_1.error; } >>>} ->>>var e_1; +>>>var e_1, _c; >>>//# sourceMappingURL=ES5For-of34.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.js b/tests/baselines/reference/ES5For-of35.js index 74bf504d781..597296cacae 100644 --- a/tests/baselines/reference/ES5For-of35.js +++ b/tests/baselines/reference/ES5For-of35.js @@ -5,19 +5,29 @@ for (const {x: a = 0, y: b = 1} of [2, 3]) { } //// [ES5For-of35.js] -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; -var __step = (this && this.__step) || function (r) { return !(r.done || (r.done = (r.result = r.iterator.next()).done)); }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; try { - for (var iterator_1 = { iterator: __values([2, 3]) }; __step(iterator_1);) { - var _a = iterator_1.result.value, _b = _a.x, a = _b === void 0 ? 0 : _b, _c = _a.y, b = _c === void 0 ? 1 : _c; + for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) { + var _c = _b.value, _d = _c.x, a = _d === void 0 ? 0 : _d, _e = _c.y, b = _e === void 0 ? 1 : _e; a; b; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { - try { __close(iterator_1); } finally { if (e_1) throw e_1.error; } + try { + if (_b && !_b.done && (_f = _a["return"])) _f.call(_a); + } + finally { if (e_1) throw e_1.error; } } -var e_1; +var e_1, _f; //# sourceMappingURL=ES5For-of35.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.js.map b/tests/baselines/reference/ES5For-of35.js.map index 514377fba60..f1ee2418d17 100644 --- a/tests/baselines/reference/ES5For-of35.js.map +++ b/tests/baselines/reference/ES5For-of35.js.map @@ -1,2 +1,2 @@ //// [ES5For-of35.js.map] -{"version":3,"file":"ES5For-of35.js","sourceRoot":"","sources":["ES5For-of35.ts"],"names":[],"mappings":";;;;IAAA,GAAG,CAAC,CAA+B,IAAA,aAAA,EAAA,UAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,EAAA,EAApC,kBAA0B;QAApB,IAAA,4BAAoB,EAAnB,SAAQ,EAAR,0BAAQ,EAAE,SAAQ,EAAR,0BAAQ;QAC1B,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} \ No newline at end of file +{"version":3,"file":"ES5For-of35.js","sourceRoot":"","sources":["ES5For-of35.ts"],"names":[],"mappings":";;;;;;;;;;;IAAA,GAAG,CAAC,CAA+B,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA;QAA9B,IAAA,aAAoB,EAAnB,SAAQ,EAAR,0BAAQ,EAAE,SAAQ,EAAR,0BAAQ;QAC1B,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of35.sourcemap.txt b/tests/baselines/reference/ES5For-of35.sourcemap.txt index 1bc0bc77b89..1961188da49 100644 --- a/tests/baselines/reference/ES5For-of35.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of35.sourcemap.txt @@ -8,101 +8,96 @@ sources: ES5For-of35.ts emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of35.js sourceFile:ES5For-of35.ts ------------------------------------------------------------------- ->>>var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; ->>>var __step = (this && this.__step) || function (r) { return !(r.done || (r.done = (r.result = r.iterator.next()).done)); }; ->>>var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +>>>var __values = (this && this.__values) || function (o) { +>>> var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +>>> if (m) return m.call(o); +>>> return { +>>> next: function () { +>>> if (o && i >= o.length) o = void 0; +>>> return { value: o && o[i++], done: !o }; +>>> } +>>> }; +>>>}; >>>try { ->>> for (var iterator_1 = { iterator: __values([2, 3]) }; __step(iterator_1);) { +>>> for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) { 1 >^^^^ 2 > ^^^ 3 > ^ 4 > ^ 5 > ^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^ -8 > ^^^^^^^^^^ -9 > ^^^^^^^^^ -10> ^ -11> ^ -12> ^^ -13> ^ -14> ^ -15> ^ -16> ^^ -17> ^^ -18> ^^^^^^^^^^^^^^^^^^ -19> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +6 > ^^^^^ +7 > ^^^^^^^^^ +8 > ^ +9 > ^ +10> ^^ +11> ^ +12> ^ +13> ^ +14> ^^^^^^^^^^^^^^^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 > for 3 > 4 > (const {x: a = 0, y: b = 1} of 5 > 6 > -7 > -8 > -9 > -10> [ -11> 2 -12> , -13> 3 -14> ] -15> -16> -17> -18> const {x: a = 0, y: b = 1} -1 >Emitted(5, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(5, 8) Source(1, 4) + SourceIndex(0) -3 >Emitted(5, 9) Source(1, 5) + SourceIndex(0) -4 >Emitted(5, 10) Source(1, 36) + SourceIndex(0) -5 >Emitted(5, 14) Source(1, 36) + SourceIndex(0) -6 >Emitted(5, 27) Source(1, 36) + SourceIndex(0) -7 >Emitted(5, 29) Source(1, 36) + SourceIndex(0) -8 >Emitted(5, 39) Source(1, 36) + SourceIndex(0) -9 >Emitted(5, 48) Source(1, 36) + SourceIndex(0) -10>Emitted(5, 49) Source(1, 37) + SourceIndex(0) -11>Emitted(5, 50) Source(1, 38) + SourceIndex(0) -12>Emitted(5, 52) Source(1, 40) + SourceIndex(0) -13>Emitted(5, 53) Source(1, 41) + SourceIndex(0) -14>Emitted(5, 54) Source(1, 42) + SourceIndex(0) -15>Emitted(5, 55) Source(1, 42) + SourceIndex(0) -16>Emitted(5, 57) Source(1, 42) + SourceIndex(0) -17>Emitted(5, 59) Source(1, 6) + SourceIndex(0) -18>Emitted(5, 77) Source(1, 32) + SourceIndex(0) +7 > +8 > [ +9 > 2 +10> , +11> 3 +12> ] +13> +14> +1 >Emitted(12, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(12, 8) Source(1, 4) + SourceIndex(0) +3 >Emitted(12, 9) Source(1, 5) + SourceIndex(0) +4 >Emitted(12, 10) Source(1, 36) + SourceIndex(0) +5 >Emitted(12, 14) Source(1, 36) + SourceIndex(0) +6 >Emitted(12, 19) Source(1, 36) + SourceIndex(0) +7 >Emitted(12, 28) Source(1, 36) + SourceIndex(0) +8 >Emitted(12, 29) Source(1, 37) + SourceIndex(0) +9 >Emitted(12, 30) Source(1, 38) + SourceIndex(0) +10>Emitted(12, 32) Source(1, 40) + SourceIndex(0) +11>Emitted(12, 33) Source(1, 41) + SourceIndex(0) +12>Emitted(12, 34) Source(1, 42) + SourceIndex(0) +13>Emitted(12, 35) Source(1, 42) + SourceIndex(0) +14>Emitted(12, 51) Source(1, 42) + SourceIndex(0) --- ->>> var _a = iterator_1.result.value, _b = _a.x, a = _b === void 0 ? 0 : _b, _c = _a.y, b = _c === void 0 ? 1 : _c; +>>> var _c = _b.value, _d = _c.x, a = _d === void 0 ? 0 : _d, _e = _c.y, b = _e === void 0 ? 1 : _e; 1->^^^^^^^^ 2 > ^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^ -5 > ^^^^^^^^^ -6 > ^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ -8 > ^^ -9 > ^^^^^^^^^ -10> ^^ -11> ^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> 2 > 3 > {x: a = 0, y: b = 1} -4 > -5 > x: a = 0 -6 > -7 > x: a = 0 -8 > , -9 > y: b = 1 -10> -11> y: b = 1 -1->Emitted(6, 9) Source(1, 12) + SourceIndex(0) -2 >Emitted(6, 13) Source(1, 12) + SourceIndex(0) -3 >Emitted(6, 41) Source(1, 32) + SourceIndex(0) -4 >Emitted(6, 43) Source(1, 13) + SourceIndex(0) -5 >Emitted(6, 52) Source(1, 21) + SourceIndex(0) -6 >Emitted(6, 54) Source(1, 13) + SourceIndex(0) -7 >Emitted(6, 80) Source(1, 21) + SourceIndex(0) -8 >Emitted(6, 82) Source(1, 23) + SourceIndex(0) -9 >Emitted(6, 91) Source(1, 31) + SourceIndex(0) -10>Emitted(6, 93) Source(1, 23) + SourceIndex(0) -11>Emitted(6, 119) Source(1, 31) + SourceIndex(0) +4 > +5 > x: a = 0 +6 > +7 > x: a = 0 +8 > , +9 > y: b = 1 +10> +11> y: b = 1 +1->Emitted(13, 9) Source(1, 12) + SourceIndex(0) +2 >Emitted(13, 13) Source(1, 12) + SourceIndex(0) +3 >Emitted(13, 26) Source(1, 32) + SourceIndex(0) +4 >Emitted(13, 28) Source(1, 13) + SourceIndex(0) +5 >Emitted(13, 37) Source(1, 21) + SourceIndex(0) +6 >Emitted(13, 39) Source(1, 13) + SourceIndex(0) +7 >Emitted(13, 65) Source(1, 21) + SourceIndex(0) +8 >Emitted(13, 67) Source(1, 23) + SourceIndex(0) +9 >Emitted(13, 76) Source(1, 31) + SourceIndex(0) +10>Emitted(13, 78) Source(1, 23) + SourceIndex(0) +11>Emitted(13, 104) Source(1, 31) + SourceIndex(0) --- >>> a; 1 >^^^^^^^^ @@ -113,9 +108,9 @@ sourceFile:ES5For-of35.ts > 2 > a 3 > ; -1 >Emitted(7, 9) Source(2, 5) + SourceIndex(0) -2 >Emitted(7, 10) Source(2, 6) + SourceIndex(0) -3 >Emitted(7, 11) Source(2, 7) + SourceIndex(0) +1 >Emitted(14, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(14, 10) Source(2, 6) + SourceIndex(0) +3 >Emitted(14, 11) Source(2, 7) + SourceIndex(0) --- >>> b; 1->^^^^^^^^ @@ -125,20 +120,23 @@ sourceFile:ES5For-of35.ts > 2 > b 3 > ; -1->Emitted(8, 9) Source(3, 5) + SourceIndex(0) -2 >Emitted(8, 10) Source(3, 6) + SourceIndex(0) -3 >Emitted(8, 11) Source(3, 7) + SourceIndex(0) +1->Emitted(15, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(15, 10) Source(3, 6) + SourceIndex(0) +3 >Emitted(15, 11) Source(3, 7) + SourceIndex(0) --- >>> } 1 >^^^^^ 1 > >} -1 >Emitted(9, 6) Source(4, 2) + SourceIndex(0) +1 >Emitted(16, 6) Source(4, 2) + SourceIndex(0) --- >>>} >>>catch (e_1_1) { e_1 = { error: e_1_1 }; } >>>finally { ->>> try { __close(iterator_1); } finally { if (e_1) throw e_1.error; } +>>> try { +>>> if (_b && !_b.done && (_f = _a["return"])) _f.call(_a); +>>> } +>>> finally { if (e_1) throw e_1.error; } >>>} ->>>var e_1; +>>>var e_1, _f; >>>//# sourceMappingURL=ES5For-of35.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36.js b/tests/baselines/reference/ES5For-of36.js index ace65b78279..fca89ee922b 100644 --- a/tests/baselines/reference/ES5For-of36.js +++ b/tests/baselines/reference/ES5For-of36.js @@ -5,27 +5,45 @@ for (let [a = 0, b = 1] of [2, 3]) { } //// [ES5For-of36.js] +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; var __read = (this && this.__read) || function (o, n) { - if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; - var m, i = m.call(o), ar = [], r, e; - try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { e = { error: error }; } - finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } return ar; }; -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; -var __step = (this && this.__step) || function (r) { return !(r.done || (r.done = (r.result = r.iterator.next()).done)); }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; try { - for (var iterator_1 = { iterator: __values([2, 3]) }; __step(iterator_1);) { - var _a = __read(iterator_1.result.value, 2), _b = _a[0], a = _b === void 0 ? 0 : _b, _c = _a[1], b = _c === void 0 ? 1 : _c; + for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) { + var _c = __read(_b.value, 2), _d = _c[0], a = _d === void 0 ? 0 : _d, _e = _c[1], b = _e === void 0 ? 1 : _e; a; b; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { - try { __close(iterator_1); } finally { if (e_1) throw e_1.error; } + try { + if (_b && !_b.done && (_f = _a["return"])) _f.call(_a); + } + finally { if (e_1) throw e_1.error; } } -var e_1; +var e_1, _f; //# sourceMappingURL=ES5For-of36.js.map \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36.js.map b/tests/baselines/reference/ES5For-of36.js.map index 8b3e7a42e98..f53bc850818 100644 --- a/tests/baselines/reference/ES5For-of36.js.map +++ b/tests/baselines/reference/ES5For-of36.js.map @@ -1,2 +1,2 @@ //// [ES5For-of36.js.map] -{"version":3,"file":"ES5For-of36.js","sourceRoot":"","sources":["ES5For-of36.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,GAAG,CAAC,CAAuB,IAAA,aAAA,EAAA,UAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,EAAA,EAA5B,kBAAkB;QAAd,IAAA,uCAAc,EAAb,UAAK,EAAL,0BAAK,EAAE,UAAK,EAAL,0BAAK;QAClB,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} \ No newline at end of file +{"version":3,"file":"ES5For-of36.js","sourceRoot":"","sources":["ES5For-of36.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA,GAAG,CAAC,CAAuB,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA;QAAxB,IAAA,wBAAc,EAAb,UAAK,EAAL,0BAAK,EAAE,UAAK,EAAL,0BAAK;QAClB,CAAC,CAAC;QACF,CAAC,CAAC;KACL"} \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of36.sourcemap.txt b/tests/baselines/reference/ES5For-of36.sourcemap.txt index f52ca8eec84..4b16e02b3b1 100644 --- a/tests/baselines/reference/ES5For-of36.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of36.sourcemap.txt @@ -8,109 +8,112 @@ sources: ES5For-of36.ts emittedFile:tests/cases/conformance/statements/for-ofStatements/ES5For-of36.js sourceFile:ES5For-of36.ts ------------------------------------------------------------------- +>>>var __values = (this && this.__values) || function (o) { +>>> var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +>>> if (m) return m.call(o); +>>> return { +>>> next: function () { +>>> if (o && i >= o.length) o = void 0; +>>> return { value: o && o[i++], done: !o }; +>>> } +>>> }; +>>>}; >>>var __read = (this && this.__read) || function (o, n) { ->>> if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; ->>> var m, i = m.call(o), ar = [], r, e; ->>> try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } +>>> var m = typeof Symbol === "function" && o[Symbol.iterator]; +>>> if (!m) return o; +>>> var i = m.call(o), r, ar = [], e; +>>> try { +>>> while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); +>>> } >>> catch (error) { e = { error: error }; } ->>> finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } +>>> finally { +>>> try { +>>> if (r && !r.done && (m = i["return"])) m.call(i); +>>> } +>>> finally { if (e) throw e.error; } +>>> } >>> return ar; >>>}; ->>>var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; ->>>var __step = (this && this.__step) || function (r) { return !(r.done || (r.done = (r.result = r.iterator.next()).done)); }; ->>>var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; >>>try { ->>> for (var iterator_1 = { iterator: __values([2, 3]) }; __step(iterator_1);) { +>>> for (var _a = __values([2, 3]), _b = _a.next(); !_b.done; _b = _a.next()) { 1 >^^^^ 2 > ^^^ 3 > ^ 4 > ^ 5 > ^^^^ -6 > ^^^^^^^^^^^^^ -7 > ^^ -8 > ^^^^^^^^^^ -9 > ^^^^^^^^^ -10> ^ -11> ^ -12> ^^ -13> ^ -14> ^ -15> ^ -16> ^^ -17> ^^ -18> ^^^^^^^^^^^^^^^^^^ -19> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +6 > ^^^^^ +7 > ^^^^^^^^^ +8 > ^ +9 > ^ +10> ^^ +11> ^ +12> ^ +13> ^ +14> ^^^^^^^^^^^^^^^^ +15> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 > for 3 > 4 > (let [a = 0, b = 1] of 5 > 6 > -7 > -8 > -9 > -10> [ -11> 2 -12> , -13> 3 -14> ] -15> -16> -17> -18> let [a = 0, b = 1] -1 >Emitted(13, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(13, 8) Source(1, 4) + SourceIndex(0) -3 >Emitted(13, 9) Source(1, 5) + SourceIndex(0) -4 >Emitted(13, 10) Source(1, 28) + SourceIndex(0) -5 >Emitted(13, 14) Source(1, 28) + SourceIndex(0) -6 >Emitted(13, 27) Source(1, 28) + SourceIndex(0) -7 >Emitted(13, 29) Source(1, 28) + SourceIndex(0) -8 >Emitted(13, 39) Source(1, 28) + SourceIndex(0) -9 >Emitted(13, 48) Source(1, 28) + SourceIndex(0) -10>Emitted(13, 49) Source(1, 29) + SourceIndex(0) -11>Emitted(13, 50) Source(1, 30) + SourceIndex(0) -12>Emitted(13, 52) Source(1, 32) + SourceIndex(0) -13>Emitted(13, 53) Source(1, 33) + SourceIndex(0) -14>Emitted(13, 54) Source(1, 34) + SourceIndex(0) -15>Emitted(13, 55) Source(1, 34) + SourceIndex(0) -16>Emitted(13, 57) Source(1, 34) + SourceIndex(0) -17>Emitted(13, 59) Source(1, 6) + SourceIndex(0) -18>Emitted(13, 77) Source(1, 24) + SourceIndex(0) +7 > +8 > [ +9 > 2 +10> , +11> 3 +12> ] +13> +14> +1 >Emitted(28, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(28, 8) Source(1, 4) + SourceIndex(0) +3 >Emitted(28, 9) Source(1, 5) + SourceIndex(0) +4 >Emitted(28, 10) Source(1, 28) + SourceIndex(0) +5 >Emitted(28, 14) Source(1, 28) + SourceIndex(0) +6 >Emitted(28, 19) Source(1, 28) + SourceIndex(0) +7 >Emitted(28, 28) Source(1, 28) + SourceIndex(0) +8 >Emitted(28, 29) Source(1, 29) + SourceIndex(0) +9 >Emitted(28, 30) Source(1, 30) + SourceIndex(0) +10>Emitted(28, 32) Source(1, 32) + SourceIndex(0) +11>Emitted(28, 33) Source(1, 33) + SourceIndex(0) +12>Emitted(28, 34) Source(1, 34) + SourceIndex(0) +13>Emitted(28, 35) Source(1, 34) + SourceIndex(0) +14>Emitted(28, 51) Source(1, 34) + SourceIndex(0) --- ->>> var _a = __read(iterator_1.result.value, 2), _b = _a[0], a = _b === void 0 ? 0 : _b, _c = _a[1], b = _c === void 0 ? 1 : _c; +>>> var _c = __read(_b.value, 2), _d = _c[0], a = _d === void 0 ? 0 : _d, _e = _c[1], b = _e === void 0 ? 1 : _e; 1->^^^^^^^^ 2 > ^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -4 > ^^ -5 > ^^^^^^^^^^ -6 > ^^ -7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ -8 > ^^ -9 > ^^^^^^^^^^ -10> ^^ -11> ^^^^^^^^^^^^^^^^^^^^^^^^^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^ +5 > ^^^^^^^^^^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^ +8 > ^^ +9 > ^^^^^^^^^^ +10> ^^ +11> ^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> 2 > 3 > [a = 0, b = 1] -4 > -5 > a = 0 -6 > -7 > a = 0 -8 > , -9 > b = 1 -10> -11> b = 1 -1->Emitted(14, 9) Source(1, 10) + SourceIndex(0) -2 >Emitted(14, 13) Source(1, 10) + SourceIndex(0) -3 >Emitted(14, 52) Source(1, 24) + SourceIndex(0) -4 >Emitted(14, 54) Source(1, 11) + SourceIndex(0) -5 >Emitted(14, 64) Source(1, 16) + SourceIndex(0) -6 >Emitted(14, 66) Source(1, 11) + SourceIndex(0) -7 >Emitted(14, 92) Source(1, 16) + SourceIndex(0) -8 >Emitted(14, 94) Source(1, 18) + SourceIndex(0) -9 >Emitted(14, 104) Source(1, 23) + SourceIndex(0) -10>Emitted(14, 106) Source(1, 18) + SourceIndex(0) -11>Emitted(14, 132) Source(1, 23) + SourceIndex(0) +4 > +5 > a = 0 +6 > +7 > a = 0 +8 > , +9 > b = 1 +10> +11> b = 1 +1->Emitted(29, 9) Source(1, 10) + SourceIndex(0) +2 >Emitted(29, 13) Source(1, 10) + SourceIndex(0) +3 >Emitted(29, 37) Source(1, 24) + SourceIndex(0) +4 >Emitted(29, 39) Source(1, 11) + SourceIndex(0) +5 >Emitted(29, 49) Source(1, 16) + SourceIndex(0) +6 >Emitted(29, 51) Source(1, 11) + SourceIndex(0) +7 >Emitted(29, 77) Source(1, 16) + SourceIndex(0) +8 >Emitted(29, 79) Source(1, 18) + SourceIndex(0) +9 >Emitted(29, 89) Source(1, 23) + SourceIndex(0) +10>Emitted(29, 91) Source(1, 18) + SourceIndex(0) +11>Emitted(29, 117) Source(1, 23) + SourceIndex(0) --- >>> a; 1 >^^^^^^^^ @@ -121,9 +124,9 @@ sourceFile:ES5For-of36.ts > 2 > a 3 > ; -1 >Emitted(15, 9) Source(2, 5) + SourceIndex(0) -2 >Emitted(15, 10) Source(2, 6) + SourceIndex(0) -3 >Emitted(15, 11) Source(2, 7) + SourceIndex(0) +1 >Emitted(30, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(30, 10) Source(2, 6) + SourceIndex(0) +3 >Emitted(30, 11) Source(2, 7) + SourceIndex(0) --- >>> b; 1->^^^^^^^^ @@ -133,20 +136,23 @@ sourceFile:ES5For-of36.ts > 2 > b 3 > ; -1->Emitted(16, 9) Source(3, 5) + SourceIndex(0) -2 >Emitted(16, 10) Source(3, 6) + SourceIndex(0) -3 >Emitted(16, 11) Source(3, 7) + SourceIndex(0) +1->Emitted(31, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(31, 10) Source(3, 6) + SourceIndex(0) +3 >Emitted(31, 11) Source(3, 7) + SourceIndex(0) --- >>> } 1 >^^^^^ 1 > >} -1 >Emitted(17, 6) Source(4, 2) + SourceIndex(0) +1 >Emitted(32, 6) Source(4, 2) + SourceIndex(0) --- >>>} >>>catch (e_1_1) { e_1 = { error: e_1_1 }; } >>>finally { ->>> try { __close(iterator_1); } finally { if (e_1) throw e_1.error; } +>>> try { +>>> if (_b && !_b.done && (_f = _a["return"])) _f.call(_a); +>>> } +>>> finally { if (e_1) throw e_1.error; } >>>} ->>>var e_1; +>>>var e_1, _f; >>>//# sourceMappingURL=ES5For-of36.js.map \ No newline at end of file diff --git a/tests/baselines/reference/arrayLiteralSpreadES5iterable.js b/tests/baselines/reference/arrayLiteralSpreadES5iterable.js index 6e24b8389ac..d71f49242dd 100644 --- a/tests/baselines/reference/arrayLiteralSpreadES5iterable.js +++ b/tests/baselines/reference/arrayLiteralSpreadES5iterable.js @@ -25,11 +25,19 @@ function f2() { //// [arrayLiteralSpreadES5iterable.js] var __read = (this && this.__read) || function (o, n) { - if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; - var m, i = m.call(o), ar = [], r, e; - try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { e = { error: error }; } - finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } return ar; }; var __spread = (this && this.__spread) || function () { diff --git a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5iterable.js b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5iterable.js index c0e896dce74..acb56cfb8ad 100644 --- a/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5iterable.js +++ b/tests/baselines/reference/destructuringArrayBindingPatternAndAssignment1ES5iterable.js @@ -71,11 +71,19 @@ var [c14, c15, c16] = [1, 2, "string"]; * ... LeftHandSideExpression */ var __read = (this && this.__read) || function (o, n) { - if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; - var m, i = m.call(o), ar = [], r, e; - try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { e = { error: error }; } - finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } return ar; }; var __spread = (this && this.__spread) || function () { diff --git a/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.js b/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.js index ca3627f3746..d9036186035 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.js +++ b/tests/baselines/reference/destructuringParameterDeclaration1ES5iterable.js @@ -102,11 +102,19 @@ function e5({x: [a, b, c]}: { x: [number, number, number] }) { } // x has type // The identifiers specified in parameter declarations and binding patterns // in a parameter list must be unique within that parameter list. var __read = (this && this.__read) || function (o, n) { - if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; - var m, i = m.call(o), ar = [], r, e; - try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { e = { error: error }; } - finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } return ar; }; // If the declaration includes a type annotation, the parameter is of that type diff --git a/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.js b/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.js index 339913732b5..ab00e874e3e 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.js +++ b/tests/baselines/reference/destructuringParameterDeclaration3ES5iterable.js @@ -50,11 +50,19 @@ foo1(1, 2, 3, E1.a, E.b); // If the parameter is a rest parameter, the parameter type is any[] // A type annotation for a rest parameter must denote an array type. var __read = (this && this.__read) || function (o, n) { - if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; - var m, i = m.call(o), ar = [], r, e; - try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { e = { error: error }; } - finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } return ar; }; var __spread = (this && this.__spread) || function () { diff --git a/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.js b/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.js index c6b3742bc6c..818ea428c1d 100644 --- a/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.js +++ b/tests/baselines/reference/destructuringParameterDeclaration7ES5iterable.js @@ -16,11 +16,19 @@ function two([], [a, b, c]: number[]) {} //// [destructuringParameterDeclaration7ES5iterable.js] var __read = (this && this.__read) || function (o, n) { - if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; - var m, i = m.call(o), ar = [], r, e; - try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { e = { error: error }; } - finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } return ar; }; function foo(_a, _b) { diff --git a/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.js b/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.js index 7990a12b1f0..83fb3de04fc 100644 --- a/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.js +++ b/tests/baselines/reference/destructuringVariableDeclaration1ES5iterable.js @@ -43,11 +43,19 @@ var {h: {h1 = [undefined, null]}}: { h: { h1: number[] } } = { h: { h1: [1, 2] } //// [destructuringVariableDeclaration1ES5iterable.js] var __read = (this && this.__read) || function (o, n) { - if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; - var m, i = m.call(o), ar = [], r, e; - try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { e = { error: error }; } - finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } return ar; }; var __spread = (this && this.__spread) || function () { diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.js b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.js index f4379253520..c63c2070290 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.js +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.js @@ -273,7 +273,16 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar function reject(value) { resume("throw", value); } function settle(f, v) { c = void 0, f(v), next(); } }; -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; var C4 = (function () { function C4() { } @@ -337,7 +346,16 @@ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } }; -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; var C5 = (function () { function C5() { } diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.js b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.js index a72919d2cc5..2a1b4393a9b 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.js +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.js @@ -227,7 +227,16 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar function reject(value) { resume("throw", value); } function settle(f, v) { c = void 0, f(v), next(); } }; -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; function f4() { return __asyncGenerator(this, arguments, function f4_1() { var x; @@ -286,7 +295,16 @@ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } }; -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; function f5() { return __asyncGenerator(this, arguments, function f5_1() { var x; diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.js b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.js index 08db037e2c1..9593562987b 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.js +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.js @@ -227,7 +227,16 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar function reject(value) { resume("throw", value); } function settle(f, v) { c = void 0, f(v), next(); } }; -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; var f4 = function () { return __asyncGenerator(this, arguments, function () { var x; @@ -286,7 +295,16 @@ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } }; -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; var f5 = function () { return __asyncGenerator(this, arguments, function () { var x; diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.js b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.js index 4bd66242318..f819945f288 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.js +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.js @@ -247,7 +247,16 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar function reject(value) { resume("throw", value); } function settle(f, v) { c = void 0, f(v), next(); } }; -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; var o4 = { f: function () { return __asyncGenerator(this, arguments, function f_1() { @@ -308,7 +317,16 @@ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { return o = __asyncValues(o), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { return function (v) { return { value: ["delegate", (o[n] || f).call(o, v)], done: false }; }; } }; -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; var o5 = { f: function () { return __asyncGenerator(this, arguments, function f_1() { diff --git a/tests/baselines/reference/emitter.forAwait.es2015.js b/tests/baselines/reference/emitter.forAwait.es2015.js index 32afacd1004..5fa516326e1 100644 --- a/tests/baselines/reference/emitter.forAwait.es2015.js +++ b/tests/baselines/reference/emitter.forAwait.es2015.js @@ -34,22 +34,27 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __asyncStep = (this && this.__asyncStep) || function (r) { return !r.done && Promise.resolve(r.iterator.next()).then(function (_) { return !(r.done = (r.result = _).done); }); }; -var __asyncValues = (this && this.__asyncIterator) || function (o) { return (m = o[Symbol.asyncIterator]) ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); var m; }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +var __asyncValues = (this && this.__asyncIterator) || function (o) { + var m = o[Symbol.asyncIterator]; + if (m) return m.call(o); + return typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; function f1() { return __awaiter(this, void 0, void 0, function* () { let y; try { - for (var y_1 = { iterator: __asyncValues(y) }; yield __asyncStep(y_1);) { - const x = y_1.result.value; + for (var y_1 = __asyncValues(y), y_1_1 = yield ["await", y_1.next()]; !y_1_1.done; y_1_1 = yield ["await", y_1.next()]) { + const x = y_1_1.value; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { - try { yield __close(y_1); } finally { if (e_1) throw e_1.error; } + try { + if (y_1_1 && !y_1_1.done && (_a = y_1.return)) yield ["await", _a.call(y_1)]; + } + finally { if (e_1) throw e_1.error; } } - var e_1; + var e_1, _a; }); } //// [file2.js] @@ -61,28 +66,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -var __asyncStep = (this && this.__asyncStep) || function (r) { return !r.done && Promise.resolve(r.iterator.next()).then(function (_) { return !(r.done = (r.result = _).done); }); }; -var __asyncValues = (this && this.__asyncIterator) || function (o) { return (m = o[Symbol.asyncIterator]) ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); var m; }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +var __asyncValues = (this && this.__asyncIterator) || function (o) { + var m = o[Symbol.asyncIterator]; + if (m) return m.call(o); + return typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; function f2() { return __awaiter(this, void 0, void 0, function* () { let x, y; try { - for (var y_1 = { iterator: __asyncValues(y) }; yield __asyncStep(y_1);) { - x = y_1.result.value; + for (var y_1 = __asyncValues(y), y_1_1 = yield ["await", y_1.next()]; !y_1_1.done; y_1_1 = yield ["await", y_1.next()]) { + x = y_1_1.value; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { - try { yield __close(y_1); } finally { if (e_1) throw e_1.error; } + try { + if (y_1_1 && !y_1_1.done && (_a = y_1.return)) yield ["await", _a.call(y_1)]; + } + finally { if (e_1) throw e_1.error; } } - var e_1; + var e_1, _a; }); } //// [file3.js] -var __asyncStep = (this && this.__asyncStep) || function (r) { return !r.done && Promise.resolve(r.iterator.next()).then(function (_) { return !(r.done = (r.result = _).done); }); }; -var __asyncValues = (this && this.__asyncIterator) || function (o) { return (m = o[Symbol.asyncIterator]) ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); var m; }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +var __asyncValues = (this && this.__asyncIterator) || function (o) { + var m = o[Symbol.asyncIterator]; + if (m) return m.call(o); + return typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { var g = generator.apply(thisArg, _arguments || []), q = [], c, i; return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; @@ -99,21 +111,26 @@ function f3() { return __asyncGenerator(this, arguments, function* f3_1() { let y; try { - for (var y_1 = { iterator: __asyncValues(y) }; yield ["await", __asyncStep(y_1)];) { - const x = y_1.result.value; + for (var y_1 = __asyncValues(y), y_1_1 = yield ["await", y_1.next()]; !y_1_1.done; y_1_1 = yield ["await", y_1.next()]) { + const x = y_1_1.value; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { - try { yield ["await", __close(y_1)]; } finally { if (e_1) throw e_1.error; } + try { + if (y_1_1 && !y_1_1.done && (_a = y_1.return)) yield ["await", _a.call(y_1)]; + } + finally { if (e_1) throw e_1.error; } } - var e_1; + var e_1, _a; }); } //// [file4.js] -var __asyncStep = (this && this.__asyncStep) || function (r) { return !r.done && Promise.resolve(r.iterator.next()).then(function (_) { return !(r.done = (r.result = _).done); }); }; -var __asyncValues = (this && this.__asyncIterator) || function (o) { return (m = o[Symbol.asyncIterator]) ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); var m; }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +var __asyncValues = (this && this.__asyncIterator) || function (o) { + var m = o[Symbol.asyncIterator]; + if (m) return m.call(o); + return typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { var g = generator.apply(thisArg, _arguments || []), q = [], c, i; return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; @@ -130,14 +147,17 @@ function f4() { return __asyncGenerator(this, arguments, function* f4_1() { let x, y; try { - for (var y_1 = { iterator: __asyncValues(y) }; yield ["await", __asyncStep(y_1)];) { - x = y_1.result.value; + for (var y_1 = __asyncValues(y), y_1_1 = yield ["await", y_1.next()]; !y_1_1.done; y_1_1 = yield ["await", y_1.next()]) { + x = y_1_1.value; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { - try { yield ["await", __close(y_1)]; } finally { if (e_1) throw e_1.error; } + try { + if (y_1_1 && !y_1_1.done && (_a = y_1.return)) yield ["await", _a.call(y_1)]; + } + finally { if (e_1) throw e_1.error; } } - var e_1; + var e_1, _a; }); } diff --git a/tests/baselines/reference/emitter.forAwait.es5.js b/tests/baselines/reference/emitter.forAwait.es5.js index 59c4399c804..6dd81f96c7f 100644 --- a/tests/baselines/reference/emitter.forAwait.es5.js +++ b/tests/baselines/reference/emitter.forAwait.es5.js @@ -61,40 +61,49 @@ var __generator = (this && this.__generator) || function (thisArg, body) { if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; -var __asyncStep = (this && this.__asyncStep) || function (r) { return !r.done && Promise.resolve(r.iterator.next()).then(function (_) { return !(r.done = (r.result = _).done); }); }; -var __asyncValues = (this && this.__asyncIterator) || function (o) { return (m = o[Symbol.asyncIterator]) ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); var m; }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +var __asyncValues = (this && this.__asyncIterator) || function (o) { + var m = o[Symbol.asyncIterator]; + if (m) return m.call(o); + return typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; function f1() { return __awaiter(this, void 0, void 0, function () { - var y, y_1, x, _a, e_1; - return __generator(this, function (_b) { - switch (_b.label) { + var y, y_1, y_1_1, x, _a, e_1, _b; + return __generator(this, function (_c) { + switch (_c.label) { case 0: - _b.trys.push([0, 5, 6, 10]); - y_1 = { iterator: __asyncValues(y) }; - _b.label = 1; - case 1: return [4 /*yield*/, __asyncStep(y_1)]; + _c.trys.push([0, 6, 7, 12]); + y_1 = __asyncValues(y); + return [4 /*yield*/, ["await", y_1.next()]]; + case 1: + y_1_1 = _c.sent(); + _c.label = 2; case 2: - if (!_b.sent()) return [3 /*break*/, 4]; - x = y_1.result.value; - _b.label = 3; - case 3: return [3 /*break*/, 1]; - case 4: return [3 /*break*/, 10]; - case 5: - _a = _b.sent(); - e_1 = { error: e_1_1 }; - return [3 /*break*/, 10]; + if (!!y_1_1.done) return [3 /*break*/, 5]; + x = y_1_1.value; + _c.label = 3; + case 3: return [4 /*yield*/, ["await", y_1.next()]]; + case 4: + y_1_1 = _c.sent(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 12]; case 6: - _b.trys.push([6, , 8, 9]); - return [4 /*yield*/, __close(y_1)]; + _a = _c.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 12]; case 7: - _b.sent(); - return [3 /*break*/, 9]; + _c.trys.push([7, , 10, 11]); + if (!(y_1_1 && !y_1_1.done && (_b = y_1.return))) return [3 /*break*/, 9]; + return [4 /*yield*/, ["await", _b.call(y_1)]]; case 8: + _c.sent(); + _c.label = 9; + case 9: return [3 /*break*/, 11]; + case 10: if (e_1) throw e_1.error; return [7 /*endfinally*/]; - case 9: return [7 /*endfinally*/]; - case 10: return [2 /*return*/]; + case 11: return [7 /*endfinally*/]; + case 12: return [2 /*return*/]; } }); }); @@ -135,40 +144,49 @@ var __generator = (this && this.__generator) || function (thisArg, body) { if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; -var __asyncStep = (this && this.__asyncStep) || function (r) { return !r.done && Promise.resolve(r.iterator.next()).then(function (_) { return !(r.done = (r.result = _).done); }); }; -var __asyncValues = (this && this.__asyncIterator) || function (o) { return (m = o[Symbol.asyncIterator]) ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); var m; }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +var __asyncValues = (this && this.__asyncIterator) || function (o) { + var m = o[Symbol.asyncIterator]; + if (m) return m.call(o); + return typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; function f2() { return __awaiter(this, void 0, void 0, function () { - var x, y, y_1, _a, e_1; - return __generator(this, function (_b) { - switch (_b.label) { + var x, y, y_1, y_1_1, _a, e_1, _b; + return __generator(this, function (_c) { + switch (_c.label) { case 0: - _b.trys.push([0, 5, 6, 10]); - y_1 = { iterator: __asyncValues(y) }; - _b.label = 1; - case 1: return [4 /*yield*/, __asyncStep(y_1)]; + _c.trys.push([0, 6, 7, 12]); + y_1 = __asyncValues(y); + return [4 /*yield*/, ["await", y_1.next()]]; + case 1: + y_1_1 = _c.sent(); + _c.label = 2; case 2: - if (!_b.sent()) return [3 /*break*/, 4]; - x = y_1.result.value; - _b.label = 3; - case 3: return [3 /*break*/, 1]; - case 4: return [3 /*break*/, 10]; - case 5: - _a = _b.sent(); - e_1 = { error: e_1_1 }; - return [3 /*break*/, 10]; + if (!!y_1_1.done) return [3 /*break*/, 5]; + x = y_1_1.value; + _c.label = 3; + case 3: return [4 /*yield*/, ["await", y_1.next()]]; + case 4: + y_1_1 = _c.sent(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 12]; case 6: - _b.trys.push([6, , 8, 9]); - return [4 /*yield*/, __close(y_1)]; + _a = _c.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 12]; case 7: - _b.sent(); - return [3 /*break*/, 9]; + _c.trys.push([7, , 10, 11]); + if (!(y_1_1 && !y_1_1.done && (_b = y_1.return))) return [3 /*break*/, 9]; + return [4 /*yield*/, ["await", _b.call(y_1)]]; case 8: + _c.sent(); + _c.label = 9; + case 9: return [3 /*break*/, 11]; + case 10: if (e_1) throw e_1.error; return [7 /*endfinally*/]; - case 9: return [7 /*endfinally*/]; - case 10: return [2 /*return*/]; + case 11: return [7 /*endfinally*/]; + case 12: return [2 /*return*/]; } }); }); @@ -201,9 +219,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) { if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; -var __asyncStep = (this && this.__asyncStep) || function (r) { return !r.done && Promise.resolve(r.iterator.next()).then(function (_) { return !(r.done = (r.result = _).done); }); }; -var __asyncValues = (this && this.__asyncIterator) || function (o) { return (m = o[Symbol.asyncIterator]) ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); var m; }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +var __asyncValues = (this && this.__asyncIterator) || function (o) { + var m = o[Symbol.asyncIterator]; + if (m) return m.call(o); + return typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { var g = generator.apply(thisArg, _arguments || []), q = [], c, i; return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; @@ -218,35 +238,42 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; function f3() { return __asyncGenerator(this, arguments, function f3_1() { - var y, y_1, x, _a, e_1; - return __generator(this, function (_b) { - switch (_b.label) { + var y, y_1, y_1_1, x, _a, e_1, _b; + return __generator(this, function (_c) { + switch (_c.label) { case 0: - _b.trys.push([0, 5, 6, 10]); - y_1 = { iterator: __asyncValues(y) }; - _b.label = 1; - case 1: return [4 /*yield*/, ["await", __asyncStep(y_1)]]; + _c.trys.push([0, 6, 7, 12]); + y_1 = __asyncValues(y); + return [4 /*yield*/, ["await", y_1.next()]]; + case 1: + y_1_1 = _c.sent(); + _c.label = 2; case 2: - if (!_b.sent()) return [3 /*break*/, 4]; - x = y_1.result.value; - _b.label = 3; - case 3: return [3 /*break*/, 1]; - case 4: return [3 /*break*/, 10]; - case 5: - _a = _b.sent(); - e_1 = { error: e_1_1 }; - return [3 /*break*/, 10]; + if (!!y_1_1.done) return [3 /*break*/, 5]; + x = y_1_1.value; + _c.label = 3; + case 3: return [4 /*yield*/, ["await", y_1.next()]]; + case 4: + y_1_1 = _c.sent(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 12]; case 6: - _b.trys.push([6, , 8, 9]); - return [4 /*yield*/, ["await", __close(y_1)]]; + _a = _c.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 12]; case 7: - _b.sent(); - return [3 /*break*/, 9]; + _c.trys.push([7, , 10, 11]); + if (!(y_1_1 && !y_1_1.done && (_b = y_1.return))) return [3 /*break*/, 9]; + return [4 /*yield*/, ["await", _b.call(y_1)]]; case 8: + _c.sent(); + _c.label = 9; + case 9: return [3 /*break*/, 11]; + case 10: if (e_1) throw e_1.error; return [7 /*endfinally*/]; - case 9: return [7 /*endfinally*/]; - case 10: return [2 /*return*/]; + case 11: return [7 /*endfinally*/]; + case 12: return [2 /*return*/]; } }); }); @@ -279,9 +306,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) { if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } }; -var __asyncStep = (this && this.__asyncStep) || function (r) { return !r.done && Promise.resolve(r.iterator.next()).then(function (_) { return !(r.done = (r.result = _).done); }); }; -var __asyncValues = (this && this.__asyncIterator) || function (o) { return (m = o[Symbol.asyncIterator]) ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator](); var m; }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +var __asyncValues = (this && this.__asyncIterator) || function (o) { + var m = o[Symbol.asyncIterator]; + if (m) return m.call(o); + return typeof __values === "function" ? __values(o) : o[Symbol.iterator](); +}; var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) { var g = generator.apply(thisArg, _arguments || []), q = [], c, i; return i = { next: verb("next"), "throw": verb("throw"), "return": verb("return") }, i[Symbol.asyncIterator] = function () { return this; }, i; @@ -296,35 +325,42 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; function f4() { return __asyncGenerator(this, arguments, function f4_1() { - var x, y, y_1, _a, e_1; - return __generator(this, function (_b) { - switch (_b.label) { + var x, y, y_1, y_1_1, _a, e_1, _b; + return __generator(this, function (_c) { + switch (_c.label) { case 0: - _b.trys.push([0, 5, 6, 10]); - y_1 = { iterator: __asyncValues(y) }; - _b.label = 1; - case 1: return [4 /*yield*/, ["await", __asyncStep(y_1)]]; + _c.trys.push([0, 6, 7, 12]); + y_1 = __asyncValues(y); + return [4 /*yield*/, ["await", y_1.next()]]; + case 1: + y_1_1 = _c.sent(); + _c.label = 2; case 2: - if (!_b.sent()) return [3 /*break*/, 4]; - x = y_1.result.value; - _b.label = 3; - case 3: return [3 /*break*/, 1]; - case 4: return [3 /*break*/, 10]; - case 5: - _a = _b.sent(); - e_1 = { error: e_1_1 }; - return [3 /*break*/, 10]; + if (!!y_1_1.done) return [3 /*break*/, 5]; + x = y_1_1.value; + _c.label = 3; + case 3: return [4 /*yield*/, ["await", y_1.next()]]; + case 4: + y_1_1 = _c.sent(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 12]; case 6: - _b.trys.push([6, , 8, 9]); - return [4 /*yield*/, ["await", __close(y_1)]]; + _a = _c.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 12]; case 7: - _b.sent(); - return [3 /*break*/, 9]; + _c.trys.push([7, , 10, 11]); + if (!(y_1_1 && !y_1_1.done && (_b = y_1.return))) return [3 /*break*/, 9]; + return [4 /*yield*/, ["await", _b.call(y_1)]]; case 8: + _c.sent(); + _c.label = 9; + case 9: return [3 /*break*/, 11]; + case 10: if (e_1) throw e_1.error; return [7 /*endfinally*/]; - case 9: return [7 /*endfinally*/]; - case 10: return [2 /*return*/]; + case 11: return [7 /*endfinally*/]; + case 12: return [2 /*return*/]; } }); }); diff --git a/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.js b/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.js index 0c6a12c45c5..45cd426549e 100644 --- a/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.js +++ b/tests/baselines/reference/emptyAssignmentPatterns02_ES5iterable.js @@ -8,11 +8,19 @@ let x, y, z, a1, a2, a3; //// [emptyAssignmentPatterns02_ES5iterable.js] var __read = (this && this.__read) || function (o, n) { - if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; - var m, i = m.call(o), ar = [], r, e; - try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { e = { error: error }; } - finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } return ar; }; var a; diff --git a/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.js b/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.js index 656bc1d4c4a..5cb4a63b03d 100644 --- a/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.js +++ b/tests/baselines/reference/emptyAssignmentPatterns04_ES5iterable.js @@ -8,11 +8,19 @@ let x, y, z, a1, a2, a3; //// [emptyAssignmentPatterns04_ES5iterable.js] var __read = (this && this.__read) || function (o, n) { - if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; - var m, i = m.call(o), ar = [], r, e; - try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { e = { error: error }; } - finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } return ar; }; var a; diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js index e93d30e3515..c4eeb9994e6 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js @@ -51,16 +51,31 @@ //// [emptyVariableDeclarationBindingPatterns01_ES5iterable.js] var __read = (this && this.__read) || function (o, n) { - if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; - var m, i = m.call(o), ar = [], r, e; - try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { e = { error: error }; } - finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } return ar; }; -var __values = (this && this.__values) || function (o) { return (i = typeof Symbol === "function" && o[Symbol.iterator] || 0) ? i.call(o) : { next: function () { return { done: d = d || i >= o.length, value: d ? void 0 : o[i++] }; } }; var i, d; }; -var __step = (this && this.__step) || function (r) { return !(r.done || (r.done = (r.result = r.iterator.next()).done)); }; -var __close = (this && this.__close) || function (r) { return (m = !(r && r.done) && r.iterator["return"]) && m.call(r.iterator); var m; }; +var __values = (this && this.__values) || function (o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +}; (function () { var a; var _a = a; @@ -92,58 +107,76 @@ var __close = (this && this.__close) || function (r) { return (m = !(r && r.done (function () { var ns = []; try { - for (var ns_1 = { iterator: __values(ns) }; __step(ns_1);) { - var _a = ns_1.result.value; + for (var ns_1 = __values(ns), ns_1_1 = ns_1.next(); !ns_1_1.done; ns_1_1 = ns_1.next()) { + var _a = ns_1_1.value; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { - try { __close(ns_1); } finally { if (e_1) throw e_1.error; } + try { + if (ns_1_1 && !ns_1_1.done && (_b = ns_1.return)) _b.call(ns_1); + } + finally { if (e_1) throw e_1.error; } } try { - for (var ns_2 = { iterator: __values(ns) }; __step(ns_2);) { - var _b = ns_2.result.value; + for (var ns_2 = __values(ns), ns_2_1 = ns_2.next(); !ns_2_1.done; ns_2_1 = ns_2.next()) { + var _c = ns_2_1.value; } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { - try { __close(ns_2); } finally { if (e_2) throw e_2.error; } + try { + if (ns_2_1 && !ns_2_1.done && (_d = ns_2.return)) _d.call(ns_2); + } + finally { if (e_2) throw e_2.error; } } try { - for (var ns_3 = { iterator: __values(ns) }; __step(ns_3);) { - var _c = ns_3.result.value; + for (var ns_3 = __values(ns), ns_3_1 = ns_3.next(); !ns_3_1.done; ns_3_1 = ns_3.next()) { + var _e = ns_3_1.value; } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { - try { __close(ns_3); } finally { if (e_3) throw e_3.error; } + try { + if (ns_3_1 && !ns_3_1.done && (_f = ns_3.return)) _f.call(ns_3); + } + finally { if (e_3) throw e_3.error; } } try { - for (var ns_4 = { iterator: __values(ns) }; __step(ns_4);) { - var _d = __read(ns_4.result.value, 0); + for (var ns_4 = __values(ns), ns_4_1 = ns_4.next(); !ns_4_1.done; ns_4_1 = ns_4.next()) { + var _g = __read(ns_4_1.value, 0); } } catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { - try { __close(ns_4); } finally { if (e_4) throw e_4.error; } + try { + if (ns_4_1 && !ns_4_1.done && (_h = ns_4.return)) _h.call(ns_4); + } + finally { if (e_4) throw e_4.error; } } try { - for (var ns_5 = { iterator: __values(ns) }; __step(ns_5);) { - var _e = __read(ns_5.result.value, 0); + for (var ns_5 = __values(ns), ns_5_1 = ns_5.next(); !ns_5_1.done; ns_5_1 = ns_5.next()) { + var _j = __read(ns_5_1.value, 0); } } catch (e_5_1) { e_5 = { error: e_5_1 }; } finally { - try { __close(ns_5); } finally { if (e_5) throw e_5.error; } + try { + if (ns_5_1 && !ns_5_1.done && (_k = ns_5.return)) _k.call(ns_5); + } + finally { if (e_5) throw e_5.error; } } try { - for (var ns_6 = { iterator: __values(ns) }; __step(ns_6);) { - var _f = __read(ns_6.result.value, 0); + for (var ns_6 = __values(ns), ns_6_1 = ns_6.next(); !ns_6_1.done; ns_6_1 = ns_6.next()) { + var _l = __read(ns_6_1.value, 0); } } catch (e_6_1) { e_6 = { error: e_6_1 }; } finally { - try { __close(ns_6); } finally { if (e_6) throw e_6.error; } + try { + if (ns_6_1 && !ns_6_1.done && (_m = ns_6.return)) _m.call(ns_6); + } + finally { if (e_6) throw e_6.error; } } - var e_1, e_2, e_3, e_4, e_5, e_6; + var e_1, _b, e_2, _d, e_3, _f, e_4, _h, e_5, _k, e_6, _m; })(); diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5iterable.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5iterable.js index e61e8b877de..b5457d0a2ec 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5iterable.js +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns02_ES5iterable.js @@ -12,11 +12,19 @@ //// [emptyVariableDeclarationBindingPatterns02_ES5iterable.js] var __read = (this && this.__read) || function (o, n) { - if (!(m = typeof Symbol === "function" && o[Symbol.iterator])) return o; - var m, i = m.call(o), ar = [], r, e; - try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } catch (error) { e = { error: error }; } - finally { try { if (m = !(r && r.done) && i["return"]) m.call(i); } finally { if (e) throw e.error; } } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } return ar; }; (function () {