mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 901987 - The RHS of a for-of loop is an assignment expression r=jorendorff
--HG-- extra : amend_source : d18317a5d17ad1c4ba243fc4184a13baf69b1415
This commit is contained in:
parent
4539a9ee78
commit
6cefd35997
@ -4274,7 +4274,7 @@ Parser<FullParseHandler>::forStatement()
|
||||
return null();
|
||||
}
|
||||
|
||||
pn3 = expr();
|
||||
pn3 = (headKind == PNK_FOROF) ? assignExpr() : expr();
|
||||
if (!pn3)
|
||||
return null();
|
||||
|
||||
|
19
js/src/jit-test/tests/for-of/syntax-4.js
Normal file
19
js/src/jit-test/tests/for-of/syntax-4.js
Normal file
@ -0,0 +1,19 @@
|
||||
// The right-hand-side of a for-of is an assignment expression.
|
||||
|
||||
load(libdir + 'asserts.js');
|
||||
|
||||
function assertSyntaxError(str) {
|
||||
assertThrowsInstanceOf(function () { return Function(str); }, SyntaxError);
|
||||
}
|
||||
|
||||
assertSyntaxError("for (var x of 1, 2) {}");
|
||||
assertSyntaxError("for (var [x] of 1, 2) {}");
|
||||
assertSyntaxError("for (var {x} of 1, 2) {}");
|
||||
|
||||
assertSyntaxError("for (let x of 1, 2) {}");
|
||||
assertSyntaxError("for (let [x] of 1, 2) {}");
|
||||
assertSyntaxError("for (let {x} of 1, 2) {}");
|
||||
|
||||
assertSyntaxError("for (const x of 1, 2) {}");
|
||||
assertSyntaxError("for (const [x] of 1, 2) {}");
|
||||
assertSyntaxError("for (const {x} of 1, 2) {}");
|
Loading…
Reference in New Issue
Block a user