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

LibJS: Implement multiplication and division operators

This commit is contained in:
Conrad Pankoff 2020-03-12 23:04:52 +11:00 committed by Andreas Kling
parent 9f3f0d9983
commit fdf7f81ba9
5 changed files with 34 additions and 1 deletions

View file

@ -115,6 +115,10 @@ Value BinaryExpression::execute(Interpreter& interpreter) const
return add(lhs_result, rhs_result);
case BinaryOp::Minus:
return sub(lhs_result, rhs_result);
case BinaryOp::Asterisk:
return mul(lhs_result, rhs_result);
case BinaryOp::Slash:
return div(lhs_result, rhs_result);
case BinaryOp::TypedEquals:
return typed_eq(lhs_result, rhs_result);
case BinaryOp::TypedInequals:
@ -194,6 +198,12 @@ void BinaryExpression::dump(int indent) const
case BinaryOp::Minus:
op_string = "-";
break;
case BinaryOp::Asterisk:
op_string = "*";
break;
case BinaryOp::Slash:
op_string = "/";
break;
case BinaryOp::TypedEquals:
op_string = "===";
break;