Files
ladybird/Tests/LibJS/Bytecode/input/named-function-expression.js
Andreas Kling 5238841da2 LibJS: Mark named function expression identifiers at individual level
Previously, when parsing a named function expression like
`Oops = function Oops() { Oops }`, the parser set a group-level flag
`might_be_variable_in_lexical_scope_in_named_function_assignment` that
propagated to the parent scope. This incorrectly prevented ALL `Oops`
identifiers from being marked as global, including those outside the
function expression.

Fix this by marking identifiers individually using
`set_is_inside_scope_with_eval()` only for identifiers inside the
function scope. This allows identifiers outside the function expression
to correctly use GetGlobal/SetGlobal while identifiers inside still
use GetBinding (since they may refer to the function's name binding).
2026-01-27 10:58:39 +01:00

9 lines
205 B
JavaScript

// Test that a named function expression only affects identifiers inside the
// function body, not identifiers outside. The outer Oops should use GetGlobal.
Oops = function Oops() {
Oops;
};
Oops.x;