mirror of
https://github.com/RGBCube/serenity
synced 2025-06-30 10:12:07 +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
1 changed files with 3 additions and 1 deletions
|
@ -714,7 +714,9 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia
|
||||||
// 1. Append n to instantiatedVarNames.
|
// 1. Append n to instantiatedVarNames.
|
||||||
|
|
||||||
// 2. Perform ! varEnv.CreateMutableBinding(n, false).
|
// 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;
|
Value initial_value;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue