Support identifier references for object initializers. (#2597)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2018-11-22 10:07:11 +01:00
committed by GitHub
parent 3d33d3258a
commit a0a6eaaee8
3 changed files with 80 additions and 0 deletions
+36
View File
@@ -27,3 +27,39 @@ default:
assert(o.func() === 244);
assert(o.ab() === 446);
switch (1) {
default:
var ab = 5;
var cd = 6;
o = {
ab,
cd: 8,
cd
}
}
assert(o.ab === 5);
assert(o.cd === 6);
function exception_expected(str) {
try {
eval(str);
assert(false);
} catch (e) {
assert(e instanceof SyntaxError);
}
}
// These forms are invalid.
exception_expected('({ true })');
exception_expected('({ 13 })');
exception_expected('({ "x" })');
switch (1) {
default:
// These forms are valid.
({ true: true });
({ 13: 13 });
({ "x": "x" });
}