mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:47:44 +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:
parent
9691286cf0
commit
5e40aa182b
4 changed files with 76 additions and 22 deletions
11
Libraries/LibJS/Tests/var-multiple-declarator.js
Normal file
11
Libraries/LibJS/Tests/var-multiple-declarator.js
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue