1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 18:15:07 +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

@ -127,6 +127,12 @@ NonnullOwnPtr<Expression> Parser::parse_secondary_expression(NonnullOwnPtr<Expre
case TokenType::Minus:
consume();
return make<BinaryExpression>(BinaryOp::Minus, move(lhs), parse_expression());
case TokenType::Asterisk:
consume();
return make<BinaryExpression>(BinaryOp::Asterisk, move(lhs), parse_expression());
case TokenType::Slash:
consume();
return make<BinaryExpression>(BinaryOp::Slash, move(lhs), parse_expression());
case TokenType::ParenOpen:
return parse_call_expression(move(lhs));
case TokenType::Equals: