1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

LibJS: Add basic support for modulo (%) in binary expressions

This commit is contained in:
Andreas Kling 2020-04-04 21:17:34 +02:00
parent 9c8363bb5f
commit 644ff1bbfd
6 changed files with 25 additions and 0 deletions

View file

@ -244,6 +244,8 @@ Value BinaryExpression::execute(Interpreter& interpreter) const
return mul(lhs_result, rhs_result);
case BinaryOp::Slash:
return div(lhs_result, rhs_result);
case BinaryOp::Modulo:
return mod(lhs_result, rhs_result);
case BinaryOp::TypedEquals:
return typed_eq(lhs_result, rhs_result);
case BinaryOp::TypedInequals:
@ -379,6 +381,9 @@ void BinaryExpression::dump(int indent) const
case BinaryOp::Slash:
op_string = "/";
break;
case BinaryOp::Modulo:
op_string = "%";
break;
case BinaryOp::TypedEquals:
op_string = "===";
break;