mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 17:28:48 +00:00
LibJS: Do not create environment bindings for local variables
If variable is local it is not stored in an environment so we don't need a binding.
This commit is contained in:
parent
4561469d52
commit
98f479318a
Notes:
sideshowbarker
2024-07-17 16:23:06 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 98f479318a
Pull-request: https://github.com/SerenityOS/serenity/pull/21164
Reviewed-by: https://github.com/awesomekling
1 changed files with 3 additions and 1 deletions
|
@ -714,7 +714,9 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia
|
|||
// 1. Append n to instantiatedVarNames.
|
||||
|
||||
// 2. Perform ! varEnv.CreateMutableBinding(n, false).
|
||||
MUST(var_environment->create_mutable_binding(vm, id.string(), false));
|
||||
// NOTE: We ignore locals because they are stored in ExecutionContext instead of environment.
|
||||
if (!id.is_local())
|
||||
MUST(var_environment->create_mutable_binding(vm, id.string(), false));
|
||||
|
||||
Value initial_value;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue