1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 21:18:14 +00:00

LibJS: Implement and use the InitializeBoundName AO

This commit is contained in:
Linus Groh 2021-12-29 10:23:18 +01:00
parent ca48151147
commit df931e6a83
4 changed files with 28 additions and 13 deletions

View file

@ -180,13 +180,7 @@ ThrowCompletionOr<void> VM::binding_initialization(FlyString const& target, Valu
{
// 1. Let name be StringValue of Identifier.
// 2. Return ? InitializeBoundName(name, value, environment).
// TODO: Use the right AO here
if (environment) {
MUST(environment->initialize_binding(global_object, target, value));
return {};
}
auto reference = resolve_binding(target);
return reference.put_value(global_object, value);
return initialize_bound_name(global_object, target, value, environment);
}
// 8.5.2 Runtime Semantics: BindingInitialization, https://tc39.es/ecma262/#sec-runtime-semantics-bindinginitialization