mirror of
https://github.com/RGBCube/serenity
synced 2025-05-24 06:15:07 +00:00

Now that we have the beginnings of a parser, let's take the script to run as a command-line argument and move all the test scripts into /home/anon/js :^) To run a script, simply use "js": $ js my-script.js To get an AST dump before execution, you can use "js -A"
9 lines
264 B
JavaScript
9 lines
264 B
JavaScript
function foo() {
|
|
function bar() {
|
|
var y = 6;
|
|
}
|
|
|
|
bar()
|
|
return y;
|
|
}
|
|
foo(); //I should return `undefined` because y is bound to the inner-most enclosing function, i.e the nested one (bar()), therefore, it's undefined in the scope of foo()
|