mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:18:11 +00:00
LibJS: Convert values to boolean for JumpIfTrue/JumpIfFalse
Value::as_bool() might fail if the underlying value isn't already a boolean value.
This commit is contained in:
parent
aefb7995f1
commit
216d27d4c1
1 changed files with 2 additions and 2 deletions
|
@ -153,7 +153,7 @@ void JumpIfFalse::execute(Bytecode::Interpreter& interpreter) const
|
|||
{
|
||||
VERIFY(m_target.has_value());
|
||||
auto result = interpreter.reg(m_result);
|
||||
if (!result.as_bool())
|
||||
if (!result.to_boolean())
|
||||
interpreter.jump(m_target.value());
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ void JumpIfTrue::execute(Bytecode::Interpreter& interpreter) const
|
|||
{
|
||||
VERIFY(m_target.has_value());
|
||||
auto result = interpreter.reg(m_result);
|
||||
if (result.as_bool())
|
||||
if (result.to_boolean())
|
||||
interpreter.jump(m_target.value());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue