mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +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:
parent
dfaa6c910c
commit
676554d3f8
8 changed files with 44 additions and 42 deletions
|
@ -215,7 +215,8 @@ ThrowCompletionOr<void> initialize_bound_name(GlobalObject& global_object, FlySt
|
|||
// 2. Else,
|
||||
else {
|
||||
// a. Let lhs be ResolveBinding(name).
|
||||
auto lhs = vm.resolve_binding(name);
|
||||
// NOTE: Although the spec pretends resolve_binding cannot fail it can just not in this case.
|
||||
auto lhs = MUST(vm.resolve_binding(name));
|
||||
|
||||
// b. Return ? PutValue(lhs, value).
|
||||
return TRY(lhs.put_value(global_object, value));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue