summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Parser.cpp
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-07-02 15:21:46 +0430
committerAndreas Kling <kling@serenityos.org>2021-07-02 14:59:03 +0200
commitccbc54358d351318337c2d49abad48c4d84290df (patch)
treefec724c4357202c59c4b0b4849df26cca6789c7a /Userland/Libraries/LibJS/Parser.cpp
parent2e00731ddb646878caf7a6bdfae4f21feaf319b2 (diff)
downloadserenity-ccbc54358d351318337c2d49abad48c4d84290df.zip
LibJS: Allow patterns in parenthesized arrow function parameters
Diffstat (limited to 'Userland/Libraries/LibJS/Parser.cpp')
-rw-r--r--Userland/Libraries/LibJS/Parser.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Parser.cpp b/Userland/Libraries/LibJS/Parser.cpp
index 624846154c..63c86d214f 100644
--- a/Userland/Libraries/LibJS/Parser.cpp
+++ b/Userland/Libraries/LibJS/Parser.cpp
@@ -645,7 +645,9 @@ Parser::PrimaryExpressionParseResult Parser::parse_primary_expression()
case TokenType::ParenOpen: {
auto paren_position = position();
consume(TokenType::ParenOpen);
- if ((match(TokenType::ParenClose) || match(TokenType::Identifier) || match(TokenType::TripleDot)) && !try_parse_arrow_function_expression_failed_at_position(paren_position)) {
+ if ((match(TokenType::ParenClose) || match(TokenType::Identifier) || match(TokenType::TripleDot) || match(TokenType::CurlyOpen) || match(TokenType::BracketOpen))
+ && !try_parse_arrow_function_expression_failed_at_position(paren_position)) {
+
auto arrow_function_result = try_parse_arrow_function_expression(true);
if (!arrow_function_result.is_null())
return { arrow_function_result.release_nonnull() };