summaryrefslogtreecommitdiff
path: root/Libraries/LibJS/Parser.cpp
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-04-23 16:06:01 +0100
committerAndreas Kling <kling@serenityos.org>2020-04-23 19:38:13 +0200
commit11728b7db5e79756e5a212c7fe4a1acaf5657767 (patch)
tree5e574b603a1e500c356dfe254090cd8b38ff99d0 /Libraries/LibJS/Parser.cpp
parent396ecfa2d79be73af9de3f9a1514925e99f02dd4 (diff)
downloadserenity-11728b7db5e79756e5a212c7fe4a1acaf5657767.zip
LibJS: Implement 'in' operator
Diffstat (limited to 'Libraries/LibJS/Parser.cpp')
-rw-r--r--Libraries/LibJS/Parser.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Libraries/LibJS/Parser.cpp b/Libraries/LibJS/Parser.cpp
index c58a9a3f27..b9b6cf0025 100644
--- a/Libraries/LibJS/Parser.cpp
+++ b/Libraries/LibJS/Parser.cpp
@@ -566,6 +566,9 @@ NonnullRefPtr<Expression> Parser::parse_secondary_expression(NonnullRefPtr<Expre
case TokenType::ExclamationMarkEquals:
consume();
return create_ast_node<BinaryExpression>(BinaryOp::AbstractInequals, move(lhs), parse_expression(min_precedence, associativity));
+ case TokenType::In:
+ consume();
+ return create_ast_node<BinaryExpression>(BinaryOp::In, move(lhs), parse_expression(min_precedence, associativity));
case TokenType::Instanceof:
consume();
return create_ast_node<BinaryExpression>(BinaryOp::InstanceOf, move(lhs), parse_expression(min_precedence, associativity));
@@ -1076,6 +1079,7 @@ bool Parser::match_secondary_expression() const
|| type == TokenType::BracketOpen
|| type == TokenType::PlusPlus
|| type == TokenType::MinusMinus
+ || type == TokenType::In
|| type == TokenType::Instanceof
|| type == TokenType::QuestionMark
|| type == TokenType::Ampersand