mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:47:35 +00:00
LibJS: Convert thrown exception to completion in binding initialization
This regressed in 676554d3
as it assumed to_reference() (already)
returned a completion type instead of putting the error in
vm.exception().
This commit is contained in:
parent
7608af13cd
commit
b303b8cf4e
1 changed files with 8 additions and 2 deletions
|
@ -303,7 +303,10 @@ ThrowCompletionOr<void> VM::property_binding_initialization(BindingPattern const
|
||||||
},
|
},
|
||||||
[&](NonnullRefPtr<BindingPattern> const&) -> ThrowCompletionOr<Optional<Reference>> { return Optional<Reference> {}; },
|
[&](NonnullRefPtr<BindingPattern> const&) -> ThrowCompletionOr<Optional<Reference>> { return Optional<Reference> {}; },
|
||||||
[&](NonnullRefPtr<MemberExpression> const& member_expression) -> ThrowCompletionOr<Optional<Reference>> {
|
[&](NonnullRefPtr<MemberExpression> const& member_expression) -> ThrowCompletionOr<Optional<Reference>> {
|
||||||
return member_expression->to_reference(interpreter(), global_object);
|
auto reference = member_expression->to_reference(interpreter(), global_object);
|
||||||
|
if (auto* thrown_exception = exception())
|
||||||
|
return JS::throw_completion(thrown_exception->value());
|
||||||
|
return reference;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (auto* thrown_exception = exception())
|
if (auto* thrown_exception = exception())
|
||||||
|
@ -350,7 +353,10 @@ ThrowCompletionOr<void> VM::iterator_binding_initialization(BindingPattern const
|
||||||
},
|
},
|
||||||
[&](NonnullRefPtr<BindingPattern> const&) -> ThrowCompletionOr<Optional<Reference>> { return Optional<Reference> {}; },
|
[&](NonnullRefPtr<BindingPattern> const&) -> ThrowCompletionOr<Optional<Reference>> { return Optional<Reference> {}; },
|
||||||
[&](NonnullRefPtr<MemberExpression> const& member_expression) -> ThrowCompletionOr<Optional<Reference>> {
|
[&](NonnullRefPtr<MemberExpression> const& member_expression) -> ThrowCompletionOr<Optional<Reference>> {
|
||||||
return member_expression->to_reference(interpreter(), global_object);
|
auto reference = member_expression->to_reference(interpreter(), global_object);
|
||||||
|
if (auto* thrown_exception = exception())
|
||||||
|
return JS::throw_completion(thrown_exception->value());
|
||||||
|
return reference;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (entry.is_rest) {
|
if (entry.is_rest) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue