1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 10:18:15 +09:00

LibJS: Implement abstract equality and inequality

This commit is contained in:
0xtechnobabble 2020-03-16 00:23:38 +02:00 committed by Andreas Kling
parent 4d22a142f7
commit dfbaa8e543
Notes: sideshowbarker 2024-07-19 08:16:45 +09:00
6 changed files with 64 additions and 2 deletions

View file

@ -155,7 +155,11 @@ Value BinaryExpression::execute(Interpreter& interpreter) const
case BinaryOp::TypedEquals:
return typed_eq(lhs_result, rhs_result);
case BinaryOp::TypedInequals:
return Value(!typed_eq(lhs_result, rhs_result).to_boolean());
return Value(!typed_eq(lhs_result, rhs_result).as_bool());
case BinaryOp::AbstractEquals:
return eq(lhs_result, rhs_result);
case BinaryOp::AbstractInequals:
return Value(!eq(lhs_result, rhs_result).as_bool());
case BinaryOp::GreaterThan:
return greater_than(lhs_result, rhs_result);
case BinaryOp::GreaterThanEquals:
@ -247,6 +251,12 @@ void BinaryExpression::dump(int indent) const
case BinaryOp::TypedInequals:
op_string = "!==";
break;
case BinaryOp::AbstractEquals:
op_string = "==";
break;
case BinaryOp::AbstractInequals:
op_string = "!=";
break;
case BinaryOp::GreaterThan:
op_string = ">";
break;