LibJS: Rewrite Parser.parse_object_expression()

This rewrite drastically increases the accuracy of object literals.
Additionally, an "assertIsSyntaxError" function has been added to
test-common.js to assist in testing syntax errors.
This commit is contained in:
Matthew Olsson 2020-05-28 22:50:06 -07:00 committed by Andreas Kling
parent 05b7fec517
commit ab576e610c
Notes: sideshowbarker 2024-07-19 05:55:20 +09:00
5 changed files with 138 additions and 59 deletions

View file

@ -66,6 +66,17 @@ try {
assert(a[2] === 3);
assert(o4.test === undefined);
assertIsSyntaxError("({ get ...foo })");
assertIsSyntaxError("({ get... foo })");
assertIsSyntaxError("({ get foo })");
assertIsSyntaxError("({ get foo: bar })");
assertIsSyntaxError("({ get [foo]: bar })");
assertIsSyntaxError("({ get ...[foo] })");
assertIsSyntaxError("({ get foo(bar) {} })");
assertIsSyntaxError("({ set foo() {} })");
assertIsSyntaxError("({ set foo(bar, baz) {} })");
assertIsSyntaxError("({ ...foo: bar })");
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);