From 395d1515eeefe5f52aab8a1365824bd0eba49215 Mon Sep 17 00:00:00 2001 From: "Salisbury, Tom" Date: Thu, 18 Jul 2019 12:32:43 +0100 Subject: [PATCH] #32458 stop ES5 __values with no Symbol.iterator getting stuck in loop --- src/compiler/factory.ts | 7 +- src/testRunner/tsconfig.json | 1 + src/testRunner/unittests/evaluation/forOf.ts | 119 ++++++++++++++++++ tests/baselines/reference/ES5For-of33.js | 7 +- tests/baselines/reference/ES5For-of33.js.map | 2 +- .../reference/ES5For-of33.sourcemap.txt | 63 +++++----- tests/baselines/reference/ES5For-of34.js | 7 +- tests/baselines/reference/ES5For-of34.js.map | 2 +- .../reference/ES5For-of34.sourcemap.txt | 95 +++++++------- tests/baselines/reference/ES5For-of35.js | 7 +- tests/baselines/reference/ES5For-of35.js.map | 2 +- .../reference/ES5For-of35.sourcemap.txt | 69 +++++----- tests/baselines/reference/ES5For-of36.js | 7 +- tests/baselines/reference/ES5For-of36.js.map | 2 +- .../reference/ES5For-of36.sourcemap.txt | 69 +++++----- tests/baselines/reference/ES5For-of37.js | 7 +- ...blockScopedBindingsInDownlevelGenerator.js | 7 +- ...mitter.asyncGenerators.classMethods.es5.js | 14 ++- ...syncGenerators.functionDeclarations.es5.js | 14 ++- ...asyncGenerators.functionExpressions.es5.js | 14 ++- ...syncGenerators.objectLiteralMethods.es5.js | 14 ++- ...eclarationBindingPatterns01_ES5iterable.js | 7 +- 22 files changed, 338 insertions(+), 198 deletions(-) create mode 100644 src/testRunner/unittests/evaluation/forOf.ts diff --git a/src/compiler/factory.ts b/src/compiler/factory.ts index 1f0294423a5..82b4a3fb59f 100644 --- a/src/compiler/factory.ts +++ b/src/compiler/factory.ts @@ -3636,15 +3636,16 @@ namespace ts { name: "typescript:values", scoped: false, text: ` - var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); };` }; diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index 659dd426b79..d69feffb787 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -75,6 +75,7 @@ "unittests/evaluation/asyncGenerator.ts", "unittests/evaluation/awaiter.ts", "unittests/evaluation/forAwaitOf.ts", + "unittests/evaluation/forOf.ts", "unittests/evaluation/objectRest.ts", "unittests/services/cancellableLanguageServiceOperations.ts", "unittests/services/colorization.ts", diff --git a/src/testRunner/unittests/evaluation/forOf.ts b/src/testRunner/unittests/evaluation/forOf.ts new file mode 100644 index 00000000000..3d9352cf926 --- /dev/null +++ b/src/testRunner/unittests/evaluation/forOf.ts @@ -0,0 +1,119 @@ +describe("unittests:: evaluation:: forOfEvaluation", () => { + it("es5 over a array with no Symbol", () => { + const result = evaluator.evaluateTypeScript(` + Symbol = undefined; + export var output = []; + export function main() { + let x = [1,2,3]; + + for (let value of x) { + output.push(value); + } + } + `, { downlevelIteration: true, target: ts.ScriptTarget.ES5 }); + + result.main(); + + assert.strictEqual(result.output[0], 1); + assert.strictEqual(result.output[1], 2); + assert.strictEqual(result.output[2], 3); + + }); + + it("es5 over a string with no Symbol", () => { + const result = evaluator.evaluateTypeScript(` + Symbol = undefined; + export var output = []; + export function main() { + let x = "hello"; + + for (let value of x) { + output.push(value); + } + } + `, { downlevelIteration: true, target: ts.ScriptTarget.ES5 }); + + result.main(); + + assert.strictEqual(result.output[0], "h"); + assert.strictEqual(result.output[1], "e"); + assert.strictEqual(result.output[2], "l"); + assert.strictEqual(result.output[3], "l"); + assert.strictEqual(result.output[4], "o"); + }); + + it("es5 over undefined with no Symbol", () => { + const result = evaluator.evaluateTypeScript(` + Symbol = undefined; + export function main() { + let x = undefined; + + for (let value of x) { + } + } + `, { downlevelIteration: true, target: ts.ScriptTarget.ES5 }); + + assert.throws(() => result.main(), "Symbol.iterator is not defined"); + }); + + it("es5 over undefined with Symbol", () => { + const result = evaluator.evaluateTypeScript(` + export function main() { + let x = undefined; + + for (let value of x) { + } + } + `, { downlevelIteration: true, target: ts.ScriptTarget.ES5 }); + + assert.throws(() => result.main(), "undefined is not iterable (cannot read property Symbol(Symbol.iterator))"); + }); + + it("es5 over object with no Symbol.iterator with no Symbol", () => { + const result = evaluator.evaluateTypeScript(` + Symbol = undefined; + export function main() { + let x = {} as any; + + for (let value of x) { + } + } + `, { downlevelIteration: true, target: ts.ScriptTarget.ES5 }); + + assert.throws(() => result.main(), "Symbol.iterator is not defined"); + }); + + it("es5 over object with no Symbol.iterator with Symbol", () => { + const result = evaluator.evaluateTypeScript(` + export function main() { + let x = {} as any; + + for (let value of x) { + } + } + `, { downlevelIteration: true, target: ts.ScriptTarget.ES5 }); + + assert.throws(() => result.main(), "Object not iterable"); + }); + + it("es5 over object with Symbol.iterator", () => { + const result = evaluator.evaluateTypeScript(` + export var output = []; + export function main() { + let thing : any = {}; + thing[Symbol.iterator] = () => { + let i = 0; + return { next() { i++; return this; }, value: i, done: i < 10 }; + }; + + for (let value of thing) + { + output.push(value) + } + + }`, { downlevelIteration: true, target: ts.ScriptTarget.ES5 }); + + result.main(); + }); + +}); \ No newline at end of file diff --git a/tests/baselines/reference/ES5For-of33.js b/tests/baselines/reference/ES5For-of33.js index 8a7bacbf52d..900f32b6407 100644 --- a/tests/baselines/reference/ES5For-of33.js +++ b/tests/baselines/reference/ES5For-of33.js @@ -4,15 +4,16 @@ for (var v of ['a', 'b', 'c']) { } //// [ES5For-of33.js] -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; var e_1, _a; try { diff --git a/tests/baselines/reference/ES5For-of33.js.map b/tests/baselines/reference/ES5For-of33.js.map index c2a28ecec79..368ef47a3f5 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,KAAc,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA,4BAAE;QAA1B,IAAI,CAAC,WAAA;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,KAAc,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA,4BAAE;QAA1B,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 8438d558c74..f6be2e8fb11 100644 --- a/tests/baselines/reference/ES5For-of33.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of33.sourcemap.txt @@ -8,15 +8,16 @@ 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) { ->>> var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +>>>var __values = (this && this.__values) || function(o) { +>>> var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; >>> if (m) return m.call(o); ->>> return { +>>> if (o && typeof o.length === "number") return { >>> next: function () { >>> if (o && i >= o.length) o = void 0; >>> return { value: o && o[i++], done: !o }; >>> } >>> }; +>>> throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); >>>}; >>>var e_1, _a; >>>try { @@ -51,21 +52,21 @@ sourceFile:ES5For-of33.ts 13> 14> 15> ) -1 >Emitted(13, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(13, 10) Source(1, 15) + SourceIndex(0) -3 >Emitted(13, 14) Source(1, 15) + SourceIndex(0) -4 >Emitted(13, 19) Source(1, 15) + SourceIndex(0) -5 >Emitted(13, 28) Source(1, 15) + SourceIndex(0) -6 >Emitted(13, 29) Source(1, 16) + SourceIndex(0) -7 >Emitted(13, 32) Source(1, 19) + SourceIndex(0) -8 >Emitted(13, 34) Source(1, 21) + SourceIndex(0) -9 >Emitted(13, 37) Source(1, 24) + SourceIndex(0) -10>Emitted(13, 39) Source(1, 26) + SourceIndex(0) -11>Emitted(13, 42) Source(1, 29) + SourceIndex(0) -12>Emitted(13, 43) Source(1, 30) + SourceIndex(0) -13>Emitted(13, 44) Source(1, 30) + SourceIndex(0) -14>Emitted(13, 60) Source(1, 30) + SourceIndex(0) -15>Emitted(13, 88) Source(1, 32) + SourceIndex(0) +1 >Emitted(14, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(14, 10) Source(1, 15) + SourceIndex(0) +3 >Emitted(14, 14) Source(1, 15) + SourceIndex(0) +4 >Emitted(14, 19) Source(1, 15) + SourceIndex(0) +5 >Emitted(14, 28) Source(1, 15) + SourceIndex(0) +6 >Emitted(14, 29) Source(1, 16) + SourceIndex(0) +7 >Emitted(14, 32) Source(1, 19) + SourceIndex(0) +8 >Emitted(14, 34) Source(1, 21) + SourceIndex(0) +9 >Emitted(14, 37) Source(1, 24) + SourceIndex(0) +10>Emitted(14, 39) Source(1, 26) + SourceIndex(0) +11>Emitted(14, 42) Source(1, 29) + SourceIndex(0) +12>Emitted(14, 43) Source(1, 30) + SourceIndex(0) +13>Emitted(14, 44) Source(1, 30) + SourceIndex(0) +14>Emitted(14, 60) Source(1, 30) + SourceIndex(0) +15>Emitted(14, 88) Source(1, 32) + SourceIndex(0) --- >>> var v = _c.value; 1 >^^^^^^^^ @@ -76,10 +77,10 @@ sourceFile:ES5For-of33.ts 2 > var 3 > v 4 > -1 >Emitted(14, 9) Source(1, 6) + SourceIndex(0) -2 >Emitted(14, 13) Source(1, 10) + SourceIndex(0) -3 >Emitted(14, 14) Source(1, 11) + SourceIndex(0) -4 >Emitted(14, 25) Source(1, 11) + SourceIndex(0) +1 >Emitted(15, 9) Source(1, 6) + SourceIndex(0) +2 >Emitted(15, 13) Source(1, 10) + SourceIndex(0) +3 >Emitted(15, 14) Source(1, 11) + SourceIndex(0) +4 >Emitted(15, 25) Source(1, 11) + SourceIndex(0) --- >>> console.log(v); 1 >^^^^^^^^ @@ -99,20 +100,20 @@ sourceFile:ES5For-of33.ts 6 > v 7 > ) 8 > ; -1 >Emitted(15, 9) Source(2, 5) + SourceIndex(0) -2 >Emitted(15, 16) Source(2, 12) + SourceIndex(0) -3 >Emitted(15, 17) Source(2, 13) + SourceIndex(0) -4 >Emitted(15, 20) Source(2, 16) + SourceIndex(0) -5 >Emitted(15, 21) Source(2, 17) + SourceIndex(0) -6 >Emitted(15, 22) Source(2, 18) + SourceIndex(0) -7 >Emitted(15, 23) Source(2, 19) + SourceIndex(0) -8 >Emitted(15, 24) Source(2, 20) + SourceIndex(0) +1 >Emitted(16, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(16, 16) Source(2, 12) + SourceIndex(0) +3 >Emitted(16, 17) Source(2, 13) + SourceIndex(0) +4 >Emitted(16, 20) Source(2, 16) + SourceIndex(0) +5 >Emitted(16, 21) Source(2, 17) + SourceIndex(0) +6 >Emitted(16, 22) Source(2, 18) + SourceIndex(0) +7 >Emitted(16, 23) Source(2, 19) + SourceIndex(0) +8 >Emitted(16, 24) Source(2, 20) + SourceIndex(0) --- >>> } 1 >^^^^^ 1 > >} -1 >Emitted(16, 6) Source(3, 2) + SourceIndex(0) +1 >Emitted(17, 6) Source(3, 2) + SourceIndex(0) --- >>>} >>>catch (e_1_1) { e_1 = { error: e_1_1 }; } diff --git a/tests/baselines/reference/ES5For-of34.js b/tests/baselines/reference/ES5For-of34.js index 821cec60ee1..d4ab664d009 100644 --- a/tests/baselines/reference/ES5For-of34.js +++ b/tests/baselines/reference/ES5For-of34.js @@ -7,15 +7,16 @@ for (foo().x of ['a', 'b', 'c']) { } //// [ES5For-of34.js] -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; var e_1, _a; function foo() { diff --git a/tests/baselines/reference/ES5For-of34.js.map b/tests/baselines/reference/ES5For-of34.js.map index 6bf7fd0baed..9535e73615c 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,SAAS,GAAG;IACR,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;;IACD,KAAgB,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA,4BAAE;QAA5B,GAAG,EAAE,CAAC,CAAC,WAAA;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,SAAS,GAAG;IACR,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AACpB,CAAC;;IACD,KAAgB,IAAA,KAAA,SAAA,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA,gBAAA,4BAAE;QAA5B,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 06e93f578e2..e64aa5cdb8c 100644 --- a/tests/baselines/reference/ES5For-of34.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of34.sourcemap.txt @@ -8,15 +8,16 @@ 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) { ->>> var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +>>>var __values = (this && this.__values) || function(o) { +>>> var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; >>> if (m) return m.call(o); ->>> return { +>>> if (o && typeof o.length === "number") return { >>> next: function () { >>> if (o && i >= o.length) o = void 0; >>> return { value: o && o[i++], done: !o }; >>> } >>> }; +>>> throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); >>>}; >>>var e_1, _a; >>>function foo() { @@ -27,9 +28,9 @@ sourceFile:ES5For-of34.ts 1 > 2 >function 3 > foo -1 >Emitted(12, 1) Source(1, 1) + SourceIndex(0) -2 >Emitted(12, 10) Source(1, 10) + SourceIndex(0) -3 >Emitted(12, 13) Source(1, 13) + SourceIndex(0) +1 >Emitted(13, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(13, 10) Source(1, 10) + SourceIndex(0) +3 >Emitted(13, 13) Source(1, 13) + SourceIndex(0) --- >>> return { x: 0 }; 1->^^^^ @@ -49,14 +50,14 @@ sourceFile:ES5For-of34.ts 6 > 0 7 > } 8 > ; -1->Emitted(13, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(13, 12) Source(2, 12) + SourceIndex(0) -3 >Emitted(13, 14) Source(2, 14) + SourceIndex(0) -4 >Emitted(13, 15) Source(2, 15) + SourceIndex(0) -5 >Emitted(13, 17) Source(2, 17) + SourceIndex(0) -6 >Emitted(13, 18) Source(2, 18) + SourceIndex(0) -7 >Emitted(13, 20) Source(2, 20) + SourceIndex(0) -8 >Emitted(13, 21) Source(2, 21) + SourceIndex(0) +1->Emitted(14, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(14, 12) Source(2, 12) + SourceIndex(0) +3 >Emitted(14, 14) Source(2, 14) + SourceIndex(0) +4 >Emitted(14, 15) Source(2, 15) + SourceIndex(0) +5 >Emitted(14, 17) Source(2, 17) + SourceIndex(0) +6 >Emitted(14, 18) Source(2, 18) + SourceIndex(0) +7 >Emitted(14, 20) Source(2, 20) + SourceIndex(0) +8 >Emitted(14, 21) Source(2, 21) + SourceIndex(0) --- >>>} 1 > @@ -65,8 +66,8 @@ sourceFile:ES5For-of34.ts 1 > > 2 >} -1 >Emitted(14, 1) Source(3, 1) + SourceIndex(0) -2 >Emitted(14, 2) Source(3, 2) + SourceIndex(0) +1 >Emitted(15, 1) Source(3, 1) + SourceIndex(0) +2 >Emitted(15, 2) Source(3, 2) + SourceIndex(0) --- >>>try { >>> for (var _b = __values(['a', 'b', 'c']), _c = _b.next(); !_c.done; _c = _b.next()) { @@ -101,21 +102,21 @@ sourceFile:ES5For-of34.ts 13> 14> 15> ) -1->Emitted(16, 5) Source(4, 1) + SourceIndex(0) -2 >Emitted(16, 10) Source(4, 17) + SourceIndex(0) -3 >Emitted(16, 14) Source(4, 17) + SourceIndex(0) -4 >Emitted(16, 19) Source(4, 17) + SourceIndex(0) -5 >Emitted(16, 28) Source(4, 17) + SourceIndex(0) -6 >Emitted(16, 29) Source(4, 18) + SourceIndex(0) -7 >Emitted(16, 32) Source(4, 21) + SourceIndex(0) -8 >Emitted(16, 34) Source(4, 23) + SourceIndex(0) -9 >Emitted(16, 37) Source(4, 26) + SourceIndex(0) -10>Emitted(16, 39) Source(4, 28) + SourceIndex(0) -11>Emitted(16, 42) Source(4, 31) + SourceIndex(0) -12>Emitted(16, 43) Source(4, 32) + SourceIndex(0) -13>Emitted(16, 44) Source(4, 32) + SourceIndex(0) -14>Emitted(16, 60) Source(4, 32) + SourceIndex(0) -15>Emitted(16, 88) Source(4, 34) + SourceIndex(0) +1->Emitted(17, 5) Source(4, 1) + SourceIndex(0) +2 >Emitted(17, 10) Source(4, 17) + SourceIndex(0) +3 >Emitted(17, 14) Source(4, 17) + SourceIndex(0) +4 >Emitted(17, 19) Source(4, 17) + SourceIndex(0) +5 >Emitted(17, 28) Source(4, 17) + SourceIndex(0) +6 >Emitted(17, 29) Source(4, 18) + SourceIndex(0) +7 >Emitted(17, 32) Source(4, 21) + SourceIndex(0) +8 >Emitted(17, 34) Source(4, 23) + SourceIndex(0) +9 >Emitted(17, 37) Source(4, 26) + SourceIndex(0) +10>Emitted(17, 39) Source(4, 28) + SourceIndex(0) +11>Emitted(17, 42) Source(4, 31) + SourceIndex(0) +12>Emitted(17, 43) Source(4, 32) + SourceIndex(0) +13>Emitted(17, 44) Source(4, 32) + SourceIndex(0) +14>Emitted(17, 60) Source(4, 32) + SourceIndex(0) +15>Emitted(17, 88) Source(4, 34) + SourceIndex(0) --- >>> foo().x = _c.value; 1 >^^^^^^^^ @@ -130,12 +131,12 @@ sourceFile:ES5For-of34.ts 4 > . 5 > x 6 > -1 >Emitted(17, 9) Source(4, 6) + SourceIndex(0) -2 >Emitted(17, 12) Source(4, 9) + SourceIndex(0) -3 >Emitted(17, 14) Source(4, 11) + SourceIndex(0) -4 >Emitted(17, 15) Source(4, 12) + SourceIndex(0) -5 >Emitted(17, 16) Source(4, 13) + SourceIndex(0) -6 >Emitted(17, 27) Source(4, 13) + SourceIndex(0) +1 >Emitted(18, 9) Source(4, 6) + SourceIndex(0) +2 >Emitted(18, 12) Source(4, 9) + SourceIndex(0) +3 >Emitted(18, 14) Source(4, 11) + SourceIndex(0) +4 >Emitted(18, 15) Source(4, 12) + SourceIndex(0) +5 >Emitted(18, 16) Source(4, 13) + SourceIndex(0) +6 >Emitted(18, 27) Source(4, 13) + SourceIndex(0) --- >>> var p = foo().x; 1 >^^^^^^^^ @@ -157,21 +158,21 @@ sourceFile:ES5For-of34.ts 7 > . 8 > x 9 > ; -1 >Emitted(18, 9) Source(5, 5) + SourceIndex(0) -2 >Emitted(18, 13) Source(5, 9) + SourceIndex(0) -3 >Emitted(18, 14) Source(5, 10) + SourceIndex(0) -4 >Emitted(18, 17) Source(5, 13) + SourceIndex(0) -5 >Emitted(18, 20) Source(5, 16) + SourceIndex(0) -6 >Emitted(18, 22) Source(5, 18) + SourceIndex(0) -7 >Emitted(18, 23) Source(5, 19) + SourceIndex(0) -8 >Emitted(18, 24) Source(5, 20) + SourceIndex(0) -9 >Emitted(18, 25) Source(5, 21) + SourceIndex(0) +1 >Emitted(19, 9) Source(5, 5) + SourceIndex(0) +2 >Emitted(19, 13) Source(5, 9) + SourceIndex(0) +3 >Emitted(19, 14) Source(5, 10) + SourceIndex(0) +4 >Emitted(19, 17) Source(5, 13) + SourceIndex(0) +5 >Emitted(19, 20) Source(5, 16) + SourceIndex(0) +6 >Emitted(19, 22) Source(5, 18) + SourceIndex(0) +7 >Emitted(19, 23) Source(5, 19) + SourceIndex(0) +8 >Emitted(19, 24) Source(5, 20) + SourceIndex(0) +9 >Emitted(19, 25) Source(5, 21) + SourceIndex(0) --- >>> } 1 >^^^^^ 1 > >} -1 >Emitted(19, 6) Source(6, 2) + SourceIndex(0) +1 >Emitted(20, 6) Source(6, 2) + SourceIndex(0) --- >>>} >>>catch (e_1_1) { e_1 = { error: e_1_1 }; } diff --git a/tests/baselines/reference/ES5For-of35.js b/tests/baselines/reference/ES5For-of35.js index 608ce967479..1158ae5ede1 100644 --- a/tests/baselines/reference/ES5For-of35.js +++ b/tests/baselines/reference/ES5For-of35.js @@ -5,15 +5,16 @@ for (const {x: a = 0, y: b = 1} of [2, 3]) { } //// [ES5For-of35.js] -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; var e_1, _a; try { diff --git a/tests/baselines/reference/ES5For-of35.js.map b/tests/baselines/reference/ES5For-of35.js.map index ca243e5bde5..ff69685616b 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,KAAmC,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA,4BAAE;QAAhC,IAAA,aAAoB,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,KAAmC,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA,4BAAE;QAAhC,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 907fc3ce690..1cabb7af3b6 100644 --- a/tests/baselines/reference/ES5For-of35.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of35.sourcemap.txt @@ -8,15 +8,16 @@ 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) { ->>> var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +>>>var __values = (this && this.__values) || function(o) { +>>> var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; >>> if (m) return m.call(o); ->>> return { +>>> if (o && typeof o.length === "number") return { >>> next: function () { >>> if (o && i >= o.length) o = void 0; >>> return { value: o && o[i++], done: !o }; >>> } >>> }; +>>> throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); >>>}; >>>var e_1, _a; >>>try { @@ -48,19 +49,19 @@ sourceFile:ES5For-of35.ts 11> 12> 13> ) -1 >Emitted(13, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(13, 10) Source(1, 36) + SourceIndex(0) -3 >Emitted(13, 14) Source(1, 36) + SourceIndex(0) -4 >Emitted(13, 19) Source(1, 36) + SourceIndex(0) -5 >Emitted(13, 28) Source(1, 36) + SourceIndex(0) -6 >Emitted(13, 29) Source(1, 37) + SourceIndex(0) -7 >Emitted(13, 30) Source(1, 38) + SourceIndex(0) -8 >Emitted(13, 32) Source(1, 40) + SourceIndex(0) -9 >Emitted(13, 33) Source(1, 41) + SourceIndex(0) -10>Emitted(13, 34) Source(1, 42) + SourceIndex(0) -11>Emitted(13, 35) Source(1, 42) + SourceIndex(0) -12>Emitted(13, 51) Source(1, 42) + SourceIndex(0) -13>Emitted(13, 79) Source(1, 44) + SourceIndex(0) +1 >Emitted(14, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(14, 10) Source(1, 36) + SourceIndex(0) +3 >Emitted(14, 14) Source(1, 36) + SourceIndex(0) +4 >Emitted(14, 19) Source(1, 36) + SourceIndex(0) +5 >Emitted(14, 28) Source(1, 36) + SourceIndex(0) +6 >Emitted(14, 29) Source(1, 37) + SourceIndex(0) +7 >Emitted(14, 30) Source(1, 38) + SourceIndex(0) +8 >Emitted(14, 32) Source(1, 40) + SourceIndex(0) +9 >Emitted(14, 33) Source(1, 41) + SourceIndex(0) +10>Emitted(14, 34) Source(1, 42) + SourceIndex(0) +11>Emitted(14, 35) Source(1, 42) + SourceIndex(0) +12>Emitted(14, 51) Source(1, 42) + SourceIndex(0) +13>Emitted(14, 79) Source(1, 44) + SourceIndex(0) --- >>> var _d = _c.value, _e = _d.x, a = _e === void 0 ? 0 : _e, _f = _d.y, b = _f === void 0 ? 1 : _f; 1->^^^^^^^^ @@ -85,17 +86,17 @@ sourceFile:ES5For-of35.ts 9 > y: b = 1 10> 11> y: b = 1 -1->Emitted(14, 9) Source(1, 12) + SourceIndex(0) -2 >Emitted(14, 13) Source(1, 12) + SourceIndex(0) -3 >Emitted(14, 26) Source(1, 32) + SourceIndex(0) -4 >Emitted(14, 28) Source(1, 13) + SourceIndex(0) -5 >Emitted(14, 37) Source(1, 21) + SourceIndex(0) -6 >Emitted(14, 39) Source(1, 13) + SourceIndex(0) -7 >Emitted(14, 65) Source(1, 21) + SourceIndex(0) -8 >Emitted(14, 67) Source(1, 23) + SourceIndex(0) -9 >Emitted(14, 76) Source(1, 31) + SourceIndex(0) -10>Emitted(14, 78) Source(1, 23) + SourceIndex(0) -11>Emitted(14, 104) Source(1, 31) + SourceIndex(0) +1->Emitted(15, 9) Source(1, 12) + SourceIndex(0) +2 >Emitted(15, 13) Source(1, 12) + SourceIndex(0) +3 >Emitted(15, 26) Source(1, 32) + SourceIndex(0) +4 >Emitted(15, 28) Source(1, 13) + SourceIndex(0) +5 >Emitted(15, 37) Source(1, 21) + SourceIndex(0) +6 >Emitted(15, 39) Source(1, 13) + SourceIndex(0) +7 >Emitted(15, 65) Source(1, 21) + SourceIndex(0) +8 >Emitted(15, 67) Source(1, 23) + SourceIndex(0) +9 >Emitted(15, 76) Source(1, 31) + SourceIndex(0) +10>Emitted(15, 78) Source(1, 23) + SourceIndex(0) +11>Emitted(15, 104) Source(1, 31) + SourceIndex(0) --- >>> a; 1 >^^^^^^^^ @@ -106,9 +107,9 @@ sourceFile:ES5For-of35.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(16, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(16, 10) Source(2, 6) + SourceIndex(0) +3 >Emitted(16, 11) Source(2, 7) + SourceIndex(0) --- >>> b; 1->^^^^^^^^ @@ -118,15 +119,15 @@ sourceFile:ES5For-of35.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(17, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(17, 10) Source(3, 6) + SourceIndex(0) +3 >Emitted(17, 11) Source(3, 7) + SourceIndex(0) --- >>> } 1 >^^^^^ 1 > >} -1 >Emitted(17, 6) Source(4, 2) + SourceIndex(0) +1 >Emitted(18, 6) Source(4, 2) + SourceIndex(0) --- >>>} >>>catch (e_1_1) { e_1 = { error: e_1_1 }; } diff --git a/tests/baselines/reference/ES5For-of36.js b/tests/baselines/reference/ES5For-of36.js index 5d53b241466..f08a178256d 100644 --- a/tests/baselines/reference/ES5For-of36.js +++ b/tests/baselines/reference/ES5For-of36.js @@ -5,15 +5,16 @@ 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; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5For-of36.js.map b/tests/baselines/reference/ES5For-of36.js.map index 09fdb4fd820..9ea2aa31df2 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,KAA2B,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA,4BAAE;QAA1B,IAAA,wBAAc,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,KAA2B,IAAA,KAAA,SAAA,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA,gBAAA,4BAAE;QAA1B,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 c3ac87f51ca..b1977e55d81 100644 --- a/tests/baselines/reference/ES5For-of36.sourcemap.txt +++ b/tests/baselines/reference/ES5For-of36.sourcemap.txt @@ -8,15 +8,16 @@ 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; +>>>var __values = (this && this.__values) || function(o) { +>>> var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; >>> if (m) return m.call(o); ->>> return { +>>> if (o && typeof o.length === "number") return { >>> next: function () { >>> if (o && i >= o.length) o = void 0; >>> return { value: o && o[i++], done: !o }; >>> } >>> }; +>>> throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); >>>}; >>>var __read = (this && this.__read) || function (o, n) { >>> var m = typeof Symbol === "function" && o[Symbol.iterator]; @@ -64,19 +65,19 @@ sourceFile:ES5For-of36.ts 11> 12> 13> ) -1 >Emitted(29, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(29, 10) Source(1, 28) + SourceIndex(0) -3 >Emitted(29, 14) Source(1, 28) + SourceIndex(0) -4 >Emitted(29, 19) Source(1, 28) + SourceIndex(0) -5 >Emitted(29, 28) Source(1, 28) + SourceIndex(0) -6 >Emitted(29, 29) Source(1, 29) + SourceIndex(0) -7 >Emitted(29, 30) Source(1, 30) + SourceIndex(0) -8 >Emitted(29, 32) Source(1, 32) + SourceIndex(0) -9 >Emitted(29, 33) Source(1, 33) + SourceIndex(0) -10>Emitted(29, 34) Source(1, 34) + SourceIndex(0) -11>Emitted(29, 35) Source(1, 34) + SourceIndex(0) -12>Emitted(29, 51) Source(1, 34) + SourceIndex(0) -13>Emitted(29, 79) Source(1, 36) + SourceIndex(0) +1 >Emitted(30, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(30, 10) Source(1, 28) + SourceIndex(0) +3 >Emitted(30, 14) Source(1, 28) + SourceIndex(0) +4 >Emitted(30, 19) Source(1, 28) + SourceIndex(0) +5 >Emitted(30, 28) Source(1, 28) + SourceIndex(0) +6 >Emitted(30, 29) Source(1, 29) + SourceIndex(0) +7 >Emitted(30, 30) Source(1, 30) + SourceIndex(0) +8 >Emitted(30, 32) Source(1, 32) + SourceIndex(0) +9 >Emitted(30, 33) Source(1, 33) + SourceIndex(0) +10>Emitted(30, 34) Source(1, 34) + SourceIndex(0) +11>Emitted(30, 35) Source(1, 34) + SourceIndex(0) +12>Emitted(30, 51) Source(1, 34) + SourceIndex(0) +13>Emitted(30, 79) Source(1, 36) + SourceIndex(0) --- >>> var _d = __read(_c.value, 2), _e = _d[0], a = _e === void 0 ? 0 : _e, _f = _d[1], b = _f === void 0 ? 1 : _f; 1->^^^^^^^^ @@ -101,17 +102,17 @@ sourceFile:ES5For-of36.ts 9 > b = 1 10> 11> b = 1 -1->Emitted(30, 9) Source(1, 10) + SourceIndex(0) -2 >Emitted(30, 13) Source(1, 10) + SourceIndex(0) -3 >Emitted(30, 37) Source(1, 24) + SourceIndex(0) -4 >Emitted(30, 39) Source(1, 11) + SourceIndex(0) -5 >Emitted(30, 49) Source(1, 16) + SourceIndex(0) -6 >Emitted(30, 51) Source(1, 11) + SourceIndex(0) -7 >Emitted(30, 77) Source(1, 16) + SourceIndex(0) -8 >Emitted(30, 79) Source(1, 18) + SourceIndex(0) -9 >Emitted(30, 89) Source(1, 23) + SourceIndex(0) -10>Emitted(30, 91) Source(1, 18) + SourceIndex(0) -11>Emitted(30, 117) Source(1, 23) + SourceIndex(0) +1->Emitted(31, 9) Source(1, 10) + SourceIndex(0) +2 >Emitted(31, 13) Source(1, 10) + SourceIndex(0) +3 >Emitted(31, 37) Source(1, 24) + SourceIndex(0) +4 >Emitted(31, 39) Source(1, 11) + SourceIndex(0) +5 >Emitted(31, 49) Source(1, 16) + SourceIndex(0) +6 >Emitted(31, 51) Source(1, 11) + SourceIndex(0) +7 >Emitted(31, 77) Source(1, 16) + SourceIndex(0) +8 >Emitted(31, 79) Source(1, 18) + SourceIndex(0) +9 >Emitted(31, 89) Source(1, 23) + SourceIndex(0) +10>Emitted(31, 91) Source(1, 18) + SourceIndex(0) +11>Emitted(31, 117) Source(1, 23) + SourceIndex(0) --- >>> a; 1 >^^^^^^^^ @@ -122,9 +123,9 @@ sourceFile:ES5For-of36.ts > 2 > a 3 > ; -1 >Emitted(31, 9) Source(2, 5) + SourceIndex(0) -2 >Emitted(31, 10) Source(2, 6) + SourceIndex(0) -3 >Emitted(31, 11) Source(2, 7) + SourceIndex(0) +1 >Emitted(32, 9) Source(2, 5) + SourceIndex(0) +2 >Emitted(32, 10) Source(2, 6) + SourceIndex(0) +3 >Emitted(32, 11) Source(2, 7) + SourceIndex(0) --- >>> b; 1->^^^^^^^^ @@ -134,15 +135,15 @@ sourceFile:ES5For-of36.ts > 2 > b 3 > ; -1->Emitted(32, 9) Source(3, 5) + SourceIndex(0) -2 >Emitted(32, 10) Source(3, 6) + SourceIndex(0) -3 >Emitted(32, 11) Source(3, 7) + SourceIndex(0) +1->Emitted(33, 9) Source(3, 5) + SourceIndex(0) +2 >Emitted(33, 10) Source(3, 6) + SourceIndex(0) +3 >Emitted(33, 11) Source(3, 7) + SourceIndex(0) --- >>> } 1 >^^^^^ 1 > >} -1 >Emitted(33, 6) Source(4, 2) + SourceIndex(0) +1 >Emitted(34, 6) Source(4, 2) + SourceIndex(0) --- >>>} >>>catch (e_1_1) { e_1 = { error: e_1_1 }; } diff --git a/tests/baselines/reference/ES5For-of37.js b/tests/baselines/reference/ES5For-of37.js index c9ea0236187..ada2710249f 100644 --- a/tests/baselines/reference/ES5For-of37.js +++ b/tests/baselines/reference/ES5For-of37.js @@ -17,15 +17,16 @@ for (const i of [0, 1, 2, 3, 4]) { //// [ES5For-of37.js] // https://github.com/microsoft/TypeScript/issues/30083 -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; var e_1, _a, e_2, _b; try { diff --git a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js index 9bb07d80b00..a0bc036f2a7 100644 --- a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js +++ b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js @@ -34,15 +34,16 @@ 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 __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; function a() { var _loop_1, _a, _b, i, e_1_1; diff --git a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.js b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.js index 25b01aa5956..629cd3b0d9b 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.js +++ b/tests/baselines/reference/emitter.asyncGenerators.classMethods.es5.js @@ -282,15 +282,16 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } }; -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; var C4 = /** @class */ (function () { function C4() { @@ -363,15 +364,16 @@ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } }; -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; var C5 = /** @class */ (function () { function C5() { diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.js b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.js index d4f6cd74132..622195d09df 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.js +++ b/tests/baselines/reference/emitter.asyncGenerators.functionDeclarations.es5.js @@ -236,15 +236,16 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } }; -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; function f4() { return __asyncGenerator(this, arguments, function f4_1() { @@ -312,15 +313,16 @@ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } }; -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; function f5() { return __asyncGenerator(this, arguments, function f5_1() { diff --git a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.js b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.js index 55efe59aeba..7d8b9ad649b 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.js +++ b/tests/baselines/reference/emitter.asyncGenerators.functionExpressions.es5.js @@ -236,15 +236,16 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } }; -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; var f4 = function () { return __asyncGenerator(this, arguments, function () { @@ -312,15 +313,16 @@ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } }; -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; var f5 = function () { return __asyncGenerator(this, arguments, function () { diff --git a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.js b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.js index 845d84e2c29..8677898f05d 100644 --- a/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.js +++ b/tests/baselines/reference/emitter.asyncGenerators.objectLiteralMethods.es5.js @@ -256,15 +256,16 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar function reject(value) { resume("throw", value); } function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } }; -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; var o4 = { f: function () { @@ -334,15 +335,16 @@ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) { return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } }; -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; var o5 = { f: function () { diff --git a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js index 80b2b04b8f0..e1a2a828b5c 100644 --- a/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js +++ b/tests/baselines/reference/emptyVariableDeclarationBindingPatterns01_ES5iterable.js @@ -65,15 +65,16 @@ var __read = (this && this.__read) || function (o, n) { } return ar; }; -var __values = (this && this.__values) || function (o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); - return { + if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; + throw new TypeError(s ? "Object not iterable." : "Symbol.iterator is not defined."); }; (function () { var a;