mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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).
9 lines
205 B
JavaScript
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;
|