mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-29 04:37:55 +00:00
LibJS: Convert to_numeric() to ThrowCompletionOr
This commit is contained in:
committed by
Linus Groh
parent
e35222a76e
commit
b8f101888b
@@ -351,9 +351,10 @@ void Return::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
|
||||
void Increment::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
auto old_value = interpreter.accumulator().to_numeric(interpreter.global_object());
|
||||
if (interpreter.vm().exception())
|
||||
auto old_value_or_error = interpreter.accumulator().to_numeric(interpreter.global_object());
|
||||
if (old_value_or_error.is_error())
|
||||
return;
|
||||
auto old_value = old_value_or_error.release_value();
|
||||
|
||||
if (old_value.is_number())
|
||||
interpreter.accumulator() = Value(old_value.as_double() + 1);
|
||||
@@ -363,9 +364,10 @@ void Increment::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
|
||||
void Decrement::execute_impl(Bytecode::Interpreter& interpreter) const
|
||||
{
|
||||
auto old_value = interpreter.accumulator().to_numeric(interpreter.global_object());
|
||||
if (interpreter.vm().exception())
|
||||
auto old_value_or_error = interpreter.accumulator().to_numeric(interpreter.global_object());
|
||||
if (old_value_or_error.is_error())
|
||||
return;
|
||||
auto old_value = old_value_or_error.release_value();
|
||||
|
||||
if (old_value.is_number())
|
||||
interpreter.accumulator() = Value(old_value.as_double() - 1);
|
||||
|
||||
Reference in New Issue
Block a user