mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:48:14 +00:00
LibJS: Use Value::to_boolean() wherever we haven't checked is_boolean()
Unless we've verified that a Value is a boolean, we should not be calling as_bool() on it.
This commit is contained in:
parent
81c6f72134
commit
fe6bd9650f
1 changed files with 2 additions and 2 deletions
|
@ -191,7 +191,7 @@ Value BinaryExpression::execute(Interpreter& interpreter) const
|
||||||
case BinaryOp::TypedEquals:
|
case BinaryOp::TypedEquals:
|
||||||
return typed_eq(lhs_result, rhs_result);
|
return typed_eq(lhs_result, rhs_result);
|
||||||
case BinaryOp::TypedInequals:
|
case BinaryOp::TypedInequals:
|
||||||
return Value(!typed_eq(lhs_result, rhs_result).as_bool());
|
return Value(!typed_eq(lhs_result, rhs_result).to_boolean());
|
||||||
case BinaryOp::Greater:
|
case BinaryOp::Greater:
|
||||||
return greater(lhs_result, rhs_result);
|
return greater(lhs_result, rhs_result);
|
||||||
case BinaryOp::Smaller:
|
case BinaryOp::Smaller:
|
||||||
|
@ -232,7 +232,7 @@ Value UnaryExpression::execute(Interpreter& interpreter) const
|
||||||
case UnaryOp::BitNot:
|
case UnaryOp::BitNot:
|
||||||
return bit_not(lhs_result);
|
return bit_not(lhs_result);
|
||||||
case UnaryOp::Not:
|
case UnaryOp::Not:
|
||||||
return Value(!lhs_result.as_bool());
|
return Value(!lhs_result.to_boolean());
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue