mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibJS: Convert resolve_binding() to ThrowCompletionOr
The spec has a note stating that resolve binding will always return a reference whose [[ReferencedName]] field is name. However this is not correct as the underlying method GetIdentifierReference may throw on env.HasBinding(name) thus it can throw. However, there are some scenarios where it cannot throw because the reference is known to exist in that case we use MUST with a comment.
This commit is contained in:
@@ -1427,9 +1427,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
switch (mode) {
|
||||
case CompleteProperty: {
|
||||
Optional<JS::Value> maybe_value;
|
||||
auto maybe_variable = vm->resolve_binding(variable_name, &global_environment);
|
||||
if (vm->exception())
|
||||
break;
|
||||
auto maybe_variable = TRY_OR_DISCARD(vm->resolve_binding(variable_name, &global_environment));
|
||||
maybe_value = TRY_OR_DISCARD(maybe_variable.get_value(interpreter->global_object()));
|
||||
VERIFY(!maybe_value->is_empty());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user