diff --git a/Userland/Libraries/LibJS/Parser.cpp b/Userland/Libraries/LibJS/Parser.cpp index 2ac76f72738..29082582893 100644 --- a/Userland/Libraries/LibJS/Parser.cpp +++ b/Userland/Libraries/LibJS/Parser.cpp @@ -777,7 +777,10 @@ RefPtr Parser::try_parse_arrow_function_expression(bool expe if (match(TokenType::CurlyOpen)) { // Parse a function body with statements - return parse_function_body(parameters, function_kind, contains_direct_call_to_eval); + consume(TokenType::CurlyOpen); + auto body = parse_function_body(parameters, function_kind, contains_direct_call_to_eval); + consume(TokenType::CurlyClose); + return body; } if (match_expression()) { // Parse a function body which returns a single expression @@ -2366,7 +2369,6 @@ NonnullRefPtr Parser::parse_function_body(Vector({ m_state.current_token.filename(), rule_start.position(), position() }); ScopePusher function_scope = ScopePusher::function_scope(*this, function_body, parameters); // FIXME <- - consume(TokenType::CurlyOpen); auto has_use_strict = parse_directive(function_body); bool previous_strict_mode = m_state.strict_mode; if (has_use_strict) { @@ -2380,6 +2382,11 @@ NonnullRefPtr Parser::parse_function_body(Vectorin_strict_mode() || function_kind != FunctionKind::Normal) { Vector parameter_names; @@ -2421,7 +2428,6 @@ NonnullRefPtr Parser::parse_function_body(Vector Parser::parse_function_node(u8 parse_options) m_state.labels_in_scope = move(old_labels_in_scope); }); + consume(TokenType::CurlyOpen); bool contains_direct_call_to_eval = false; auto body = parse_function_body(parameters, function_kind, contains_direct_call_to_eval); + consume(TokenType::CurlyClose); auto has_strict_directive = body->in_strict_mode();