mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 15:48:12 +00:00
LibJS: Allow assignment expression in spreading property definition
See: https://tc39.es/ecma262/#sec-runtime-semantics-propertydefinitionevaluation PropertyDefinition : ... AssignmentExpression Also add a test for this in array spreading, which already had this in place.
This commit is contained in:
parent
766cd852d3
commit
3ceedbd16a
3 changed files with 41 additions and 1 deletions
|
@ -23,3 +23,23 @@ test("basic functionality", () => {
|
|||
|
||||
expect([...[], ...[...[1, 2, 3]], 4]).toEqual([1, 2, 3, 4]);
|
||||
});
|
||||
|
||||
test("allows assignment expressions", () => {
|
||||
expect("([ ...a = { hello: 'world' } ])").toEval();
|
||||
expect("([ ...a += 'hello' ])").toEval();
|
||||
expect("([ ...a -= 'hello' ])").toEval();
|
||||
expect("([ ...a **= 'hello' ])").toEval();
|
||||
expect("([ ...a *= 'hello' ])").toEval();
|
||||
expect("([ ...a /= 'hello' ])").toEval();
|
||||
expect("([ ...a %= 'hello' ])").toEval();
|
||||
expect("([ ...a <<= 'hello' ])").toEval();
|
||||
expect("([ ...a >>= 'hello' ])").toEval();
|
||||
expect("([ ...a >>>= 'hello' ])").toEval();
|
||||
expect("([ ...a &= 'hello' ])").toEval();
|
||||
expect("([ ...a ^= 'hello' ])").toEval();
|
||||
expect("([ ...a |= 'hello' ])").toEval();
|
||||
expect("([ ...a &&= 'hello' ])").toEval();
|
||||
expect("([ ...a ||= 'hello' ])").toEval();
|
||||
expect("([ ...a ??= 'hello' ])").toEval();
|
||||
expect("function* test() { return ([ ...yield a ]); }").toEval();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue