1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

LibJS: Implement <= and >= binary operators

This commit is contained in:
Conrad Pankoff 2020-03-12 23:07:08 +11:00 committed by Andreas Kling
parent fdf7f81ba9
commit 0fe87c5fec
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());