LibJS: Implement <= and >= binary operators

This commit is contained in:
Conrad Pankoff 2020-03-12 23:07:08 +11:00 committed by Andreas Kling
commit 0fe87c5fec
Notes: sideshowbarker 2024-07-19 08:45:08 +09:00
6 changed files with 38 additions and 0 deletions

View file

@ -96,6 +96,13 @@ Value greater_than(Value lhs, Value rhs)
return Value(lhs.as_double() > rhs.as_double());
}
Value greater_than_equals(Value lhs, Value rhs)
{
ASSERT(lhs.is_number());
ASSERT(rhs.is_number());
return Value(lhs.as_double() >= rhs.as_double());
}
Value less_than(Value lhs, Value rhs)
{
ASSERT(lhs.is_number());
@ -103,6 +110,13 @@ Value less_than(Value lhs, Value rhs)
return Value(lhs.as_double() < rhs.as_double());
}
Value less_than_equals(Value lhs, Value rhs)
{
ASSERT(lhs.is_number());
ASSERT(rhs.is_number());
return Value(lhs.as_double() <= rhs.as_double());
}
Value bitwise_and(Value lhs, Value rhs)
{
ASSERT(lhs.is_number());