mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-11 17:37:33 +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
513 B
JavaScript
31 lines
513 B
JavaScript
// eval inside with: both poisons apply.
|
|
function eval_in_with(obj) {
|
|
let a = 1;
|
|
with (obj) {
|
|
eval("");
|
|
a;
|
|
}
|
|
}
|
|
|
|
// with inside eval-poisoned function.
|
|
function with_after_eval(obj) {
|
|
let b = 1;
|
|
eval("");
|
|
with (obj) {
|
|
b;
|
|
}
|
|
}
|
|
|
|
// eval in one branch, with in another -- both poison the function.
|
|
function branched_poison(flag, obj) {
|
|
let c = 1;
|
|
if (flag) {
|
|
eval("");
|
|
} else {
|
|
with (obj) {
|
|
c;
|
|
}
|
|
}
|
|
return c;
|
|
}
|