mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:17:35 +00:00
LibJS/Bytecode: Throw on destructuring object assignment to nullish LHS
24 new passes on test262. :^)
This commit is contained in:
parent
4032bfc2fc
commit
8021048bc9
4 changed files with 30 additions and 0 deletions
|
@ -844,6 +844,15 @@ ThrowCompletionOr<void> ThrowIfNotObject::execute_impl(Bytecode::Interpreter& in
|
|||
return {};
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> ThrowIfNullish::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
auto& vm = interpreter.vm();
|
||||
auto value = interpreter.accumulator();
|
||||
if (value.is_nullish())
|
||||
return vm.throw_completion<TypeError>(ErrorType::NotObjectCoercible, TRY_OR_THROW_OOM(vm, value.to_string_without_side_effects()));
|
||||
return {};
|
||||
}
|
||||
|
||||
ThrowCompletionOr<void> EnterUnwindContext::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
interpreter.enter_unwind_context(m_handler_target, m_finalizer_target);
|
||||
|
@ -1432,6 +1441,11 @@ DeprecatedString ThrowIfNotObject::to_deprecated_string_impl(Bytecode::Executabl
|
|||
return "ThrowIfNotObject";
|
||||
}
|
||||
|
||||
DeprecatedString ThrowIfNullish::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
return "ThrowIfNullish";
|
||||
}
|
||||
|
||||
DeprecatedString EnterUnwindContext::to_deprecated_string_impl(Bytecode::Executable const&) const
|
||||
{
|
||||
auto handler_string = m_handler_target.has_value() ? DeprecatedString::formatted("{}", *m_handler_target) : "<empty>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue