1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

LibJS: Parse arrow function expression with correct precedence

The parser was chomping on commas present after the arrow function expression. eg. [x=>x,2] would parse as [x=>(x,2)] instead of [(x=>x),2].

This is not the case anymore. I've added a small test to prove this.
This commit is contained in:
Marcin Gasperowicz 2020-05-29 22:03:47 +02:00 committed by Andreas Kling
parent 20faa93cb0
commit 4e8de753c9
3 changed files with 7 additions and 5 deletions

View file

@ -16,6 +16,10 @@ try {
};
assert(addBlock(5, 4) === 9);
let chompy = [(x) => x, 2];
assert(chompy.length === 2);
assert(chompy[0](1) === 1);
const makeObject = (a, b) => ({ a, b });
const obj = makeObject(33, 44);
assert(typeof obj === "object");