Files
ladybird/Tests/LibJS/AST/input/eval-with-interaction.js
Andreas Kling f7c961136f Tests/LibJS: Add AST dump test cases
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.
2026-02-10 02:05:20 +01:00

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;
}