Index: src/parsing/parser-base.h |
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h |
index c349cdd094855420aa2c29ff985eb2777650ce27..02df5cf392f01b432d8f972849d53eddb47d6917 100644 |
--- a/src/parsing/parser-base.h |
+++ b/src/parsing/parser-base.h |
@@ -2276,7 +2276,7 @@ ParserBase<Impl>::ParseClassFieldForInitializer(bool has_initializer, |
initializer_state.expected_property_count(), 0, 0, |
FunctionLiteral::kNoDuplicateParameters, |
FunctionLiteral::kAnonymousExpression, default_eager_compile_hint_, |
- initializer_scope->start_position()); |
+ initializer_scope->start_position(), true); |
function_literal->set_is_class_field_initializer(true); |
return function_literal; |
} |
@@ -3910,6 +3910,7 @@ ParserBase<Impl>::ParseArrowFunctionLiteral( |
bool is_lazy_top_level_function = |
can_preparse && impl()->AllowsLazyParsingWithoutUnresolvedVariables(); |
bool should_be_used_once_hint = false; |
+ bool has_braces = true; |
{ |
FunctionState function_state(&function_state_, &scope_state_, |
formal_parameters.scope); |
@@ -3972,6 +3973,7 @@ ParserBase<Impl>::ParseArrowFunctionLiteral( |
} |
} else { |
// Single-expression body |
+ has_braces = false; |
int pos = position(); |
DCHECK(ReturnExprContext::kInsideValidBlock == |
function_state_->return_expr_context()); |
@@ -3989,7 +3991,9 @@ ParserBase<Impl>::ParseArrowFunctionLiteral( |
} else { |
ExpressionT expression = ParseAssignmentExpression(accept_IN, CHECK_OK); |
impl()->RewriteNonPattern(CHECK_OK); |
- body->Add(factory()->NewReturnStatement(expression, pos), zone()); |
+ body->Add( |
+ factory()->NewReturnStatement(expression, expression->position()), |
+ zone()); |
if (allow_tailcalls() && !is_sloppy(language_mode())) { |
// ES6 14.6.1 Static Semantics: IsInTailPosition |
impl()->MarkTailPosition(expression); |
@@ -4032,7 +4036,7 @@ ParserBase<Impl>::ParseArrowFunctionLiteral( |
formal_parameters.num_parameters(), formal_parameters.function_length, |
FunctionLiteral::kNoDuplicateParameters, |
FunctionLiteral::kAnonymousExpression, eager_compile_hint, |
- formal_parameters.scope->start_position()); |
+ formal_parameters.scope->start_position(), has_braces); |
function_literal->set_function_token_position( |
formal_parameters.scope->start_position()); |