mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-14 02:46:57 +02:00
Add 39 test cases exercising AST dump output and scope analysis. Tests cover local/global identifier marking, eval/with poisoning, destructuring, closures, hoisting, classes, generators, and more.
31 lines
596 B
JavaScript
31 lines
596 B
JavaScript
// Indirect eval (not a direct call to `eval`) does NOT poison scope.
|
|
function indirect_eval() {
|
|
let x = 1;
|
|
(0, eval)("x");
|
|
return x;
|
|
}
|
|
|
|
// Assigning eval to a variable and calling it is also indirect.
|
|
function eval_alias() {
|
|
let x = 1;
|
|
var e = eval;
|
|
e("x");
|
|
return x;
|
|
}
|
|
|
|
// eval as a method call is indirect.
|
|
function eval_method() {
|
|
let x = 1;
|
|
var obj = { eval };
|
|
obj.eval("x");
|
|
return x;
|
|
}
|
|
|
|
// Calling something NAMED eval that isn't the global eval.
|
|
function local_eval_name() {
|
|
let x = 1;
|
|
let eval = s => s;
|
|
eval("x");
|
|
return x;
|
|
}
|