Index: src/parsing/parser-base.h |
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h |
index 484d4b977e04c66bd26d3b42d860e00195fd6802..89b5b10da965e0068fbfc66c42a30c2c4fd3e4ba 100644 |
--- a/src/parsing/parser-base.h |
+++ b/src/parsing/parser-base.h |
@@ -2228,6 +2228,17 @@ ParserBase<Traits>::ParseTailCallExpression(ExpressionClassifier* classifier, |
CheckNoTailCallExpressions(classifier, CHECK_OK); |
Scanner::Location loc(pos, scanner()->location().end_pos); |
+ if (!expression->IsCall()) { |
+ Scanner::Location sub_loc(sub_expression_pos, loc.end_pos); |
+ ReportMessageAt(sub_loc, MessageTemplate::kUnexpectedInsideTailCall); |
+ *ok = false; |
+ return Traits::EmptyExpression(); |
+ } |
+ if (!is_strict(language_mode())) { |
+ ReportMessageAt(loc, MessageTemplate::kUnexpectedSloppyTailCall); |
+ *ok = false; |
+ return Traits::EmptyExpression(); |
+ } |
ReturnExprContext return_expr_context = |
function_state_->return_expr_context(); |
if (return_expr_context != ReturnExprContext::kInsideValidReturnStatement) { |
@@ -2250,12 +2261,6 @@ ParserBase<Traits>::ParseTailCallExpression(ExpressionClassifier* classifier, |
*ok = false; |
return Traits::EmptyExpression(); |
} |
- if (!expression->IsCall()) { |
- Scanner::Location sub_loc(sub_expression_pos, loc.end_pos); |
- ReportMessageAt(sub_loc, MessageTemplate::kUnexpectedInsideTailCall); |
- *ok = false; |
- return Traits::EmptyExpression(); |
- } |
classifier->RecordTailCallExpressionError( |
loc, MessageTemplate::kUnexpectedTailCall); |
function_state_->AddExpressionInTailPosition(expression, loc); |