summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Parser.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-04-23 13:45:19 +0100
committerAndreas Kling <kling@serenityos.org>2020-04-23 19:38:13 +0200
commit502d1f5165d623818d04851b1bacf327709b9007 (patch)
treeae2e392ae49e2a6d20516a4a74e5180f82057772 /Libraries/LibJS/Parser.cpp
parentf0e7404480d7712d004fcd9ff6908b6df812b54a (diff)
downloadserenity-502d1f5165d623818d04851b1bacf327709b9007.zip
LibJS: Implement bitwise right shift operator (>>)
Diffstat (limited to 'Libraries/LibJS/Parser.cpp')
-rw-r--r--Libraries/LibJS/Parser.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/Libraries/LibJS/Parser.cpp b/Libraries/LibJS/Parser.cpp
index 548d916ad3..182d76653a 100644
--- a/Libraries/LibJS/Parser.cpp
+++ b/Libraries/LibJS/Parser.cpp
@@ -583,6 +583,12 @@ NonnullRefPtr<Expression> Parser::parse_secondary_expression(NonnullRefPtr<Expre
case TokenType::ShiftLeftEquals:
consume();
return create_ast_node<AssignmentExpression>(AssignmentOp::LeftShiftAssignment, move(lhs), parse_expression(min_precedence, associativity));
+ case TokenType::ShiftRight:
+ consume();
+ return create_ast_node<BinaryExpression>(BinaryOp::RightShift, move(lhs), parse_expression(min_precedence, associativity));
+ case TokenType::ShiftRightEquals:
+ consume();
+ return create_ast_node<AssignmentExpression>(AssignmentOp::RightShiftAssignment, move(lhs), parse_expression(min_precedence, associativity));
case TokenType::ParenOpen:
return parse_call_expression(move(lhs));
case TokenType::Equals:
@@ -1070,6 +1076,8 @@ bool Parser::match_secondary_expression() const
|| type == TokenType::Caret
|| type == TokenType::ShiftLeft
|| type == TokenType::ShiftLeftEquals
+ || type == TokenType::ShiftRight
+ || type == TokenType::ShiftRightEquals
|| type == TokenType::DoubleAmpersand
|| type == TokenType::DoublePipe
|| type == TokenType::DoubleQuestionMark;