1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:07:34 +00:00

LibJS: Support VariableDeclaration with multiple declarators

This patch adds support in the parser and interpreter for this:

    var a = 1, b = 2, c = a + b;

VariableDeclaration is now a sequence of VariableDeclarators. :^)
This commit is contained in:
Andreas Kling 2020-04-04 21:46:25 +02:00
parent 9691286cf0
commit 5e40aa182b
4 changed files with 76 additions and 22 deletions

View file

@ -0,0 +1,11 @@
function assert(x) { if (!x) throw 1; }
try {
var a = 1, b = 2, c = a + b;
assert(a === 1);
assert(b === 2);
assert(c === 3);
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}