mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-29 11:07:16 +02:00
LibJS: Get initial_value from local variables if id represents a local
If identifier represents local variable we should get its value from `local_variables` in `ExecutionContext` instead of environment.
This commit is contained in:
committed by
Andreas Kling
parent
675d919dd2
commit
a4a94de942
Notes:
sideshowbarker
2024-07-17 10:31:19 +09:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/SerenityOS/serenity/commit/a4a94de942 Pull-request: https://github.com/SerenityOS/serenity/pull/21141
@@ -661,7 +661,11 @@ ThrowCompletionOr<void> ECMAScriptFunctionObject::function_declaration_instantia
|
||||
// 4. Else,
|
||||
else {
|
||||
// a. Let initialValue be ! env.GetBindingValue(n, false).
|
||||
initial_value = MUST(environment->get_binding_value(vm, id.string(), false));
|
||||
if (id.is_local()) {
|
||||
initial_value = callee_context.local_variables[id.local_variable_index()];
|
||||
} else {
|
||||
initial_value = MUST(environment->get_binding_value(vm, id.string(), false));
|
||||
}
|
||||
}
|
||||
|
||||
// 5. Perform ! varEnv.InitializeBinding(n, initialValue).
|
||||
|
||||
Reference in New Issue
Block a user