mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibJS: Add an initialize binding hint to all initialize_binding methods
This will allow us to specify things like SyncDispose and perhaps AsyncDispose in the future.
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 08:59:31 +09:00
Author: https://github.com/davidot Commit: https://github.com/SerenityOS/serenity/commit/a746739cb0 Pull-request: https://github.com/SerenityOS/serenity/pull/16630 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/linusg ✅
@@ -323,7 +323,7 @@ Value FunctionExpression::instantiate_ordinary_function_expression(Interpreter&
|
||||
// FIXME: 7. Perform MakeConstructor(closure).
|
||||
|
||||
if (has_own_name)
|
||||
MUST(environment->initialize_binding(vm, name(), closure));
|
||||
MUST(environment->initialize_binding(vm, name(), closure, Environment::InitializeBindingHint::Normal));
|
||||
|
||||
return closure;
|
||||
}
|
||||
@@ -1973,7 +1973,7 @@ ThrowCompletionOr<ECMAScriptFunctionObject*> ClassExpression::class_definition_e
|
||||
restore_environment.disarm();
|
||||
|
||||
if (!binding_name.is_null())
|
||||
MUST(class_environment->initialize_binding(vm, binding_name, class_constructor));
|
||||
MUST(class_environment->initialize_binding(vm, binding_name, class_constructor, Environment::InitializeBindingHint::Normal));
|
||||
|
||||
for (auto& field : instance_fields)
|
||||
class_constructor->add_field(field);
|
||||
@@ -3864,7 +3864,7 @@ Completion TryStatement::execute(Interpreter& interpreter) const
|
||||
// 5. Let status be Completion(BindingInitialization of CatchParameter with arguments thrownValue and catchEnv).
|
||||
auto status = m_handler->parameter().visit(
|
||||
[&](DeprecatedFlyString const& parameter) {
|
||||
return catch_environment->initialize_binding(vm, parameter, thrown_value);
|
||||
return catch_environment->initialize_binding(vm, parameter, thrown_value, Environment::InitializeBindingHint::Normal);
|
||||
},
|
||||
[&](NonnullRefPtr<BindingPattern> const& pattern) {
|
||||
return vm.binding_initialization(pattern, thrown_value, catch_environment);
|
||||
|
||||
Reference in New Issue
Block a user