mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibJS: Elide empty lexical environment when direct eval() is present
Direct eval() always creates a new lexical environment, so we don't have to worry about those here. The var environments still need special care.
This commit is contained in:
parent
f6141df589
commit
842a189c2e
Notes:
github-actions[bot]
2025-03-20 17:52:20 +00:00
Author: https://github.com/awesomekling
Commit: 842a189c2e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4017
1 changed files with 2 additions and 2 deletions
|
@ -164,8 +164,8 @@ CodeGenerationErrorOr<void> Generator::emit_function_declaration_instantiation(E
|
|||
}
|
||||
|
||||
if (!function.m_strict) {
|
||||
bool can_elide_declarative_environment = !function.m_contains_direct_call_to_eval && (!scope_body || !scope_body->has_non_local_lexical_declarations());
|
||||
if (!can_elide_declarative_environment) {
|
||||
bool can_elide_lexical_environment = !scope_body || !scope_body->has_non_local_lexical_declarations();
|
||||
if (!can_elide_lexical_environment) {
|
||||
emit<Op::CreateLexicalEnvironment>(function.m_lex_environment_bindings_count);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue