diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/tests/ecma_6/Comprehensions/generator-semantics.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/tests/ecma_6/Comprehensions/generator-semantics.js')
-rw-r--r-- | js/src/tests/ecma_6/Comprehensions/generator-semantics.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/js/src/tests/ecma_6/Comprehensions/generator-semantics.js b/js/src/tests/ecma_6/Comprehensions/generator-semantics.js new file mode 100644 index 000000000..52426115f --- /dev/null +++ b/js/src/tests/ecma_6/Comprehensions/generator-semantics.js @@ -0,0 +1,52 @@ +// Interaction of eval with generator expressions. +function a1() { + var a = 10; + var g = (for (y of [0]) eval('var a=42;')); + g.next(); + return a; +} +assertEq(a1(), 10); + +function a2() { + var a = 10; + (for (y of [0]) eval('a=42')).next(); + return a; +} +assertEq(a2(), 42) + +// Arguments and this. +function b1() { + return [for (arg of (for (i of [0, 1, 2]) arguments[i])) arg]; +} +assertDeepEq(b1('a', 'b', 'c'), ['a', 'b', 'c']); + +function b2() { + return [for (x of (for (i of [0]) this)) x]; +} +var b2o = { b2: b2 } +assertDeepEq(b2o.b2(), [b2o]) + +// Assignment to eval or arguments. +function c1() { + return [for (arg of (for (i of [0, 1, 2]) arguments = i)) arg]; +} +assertDeepEq(c1(), [0, 1, 2]); + +function c2() { + "use strict"; + return eval('[for (arg of (for (i of [0, 1, 2]) arguments = i)) arg]'); +} +assertThrows(c2, SyntaxError); + +function c3() { + return [for (arg of (for (i of [0, 1, 2]) eval = i)) arg]; +} +assertDeepEq(c3(), [0, 1, 2]); + +function c4() { + "use strict"; + return eval('[for (arg of (for (i of [0, 1, 2]) eval = i)) arg]'); +} +assertThrows(c4, SyntaxError); + +reportCompare(null, null, "test"); |