Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: src/parsing/parser-base.h

Issue 2278413003: Disallow tail calls from async functions and generators (Closed)
Patch Set: Adding test suggested by neis Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | test/message/syntactic-tail-call-generator.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser-base.h
diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h
index 42db4816de3ed060e3ec4dacfe07a8053dfd6fa6..70f9d708fc4bec163ae7f248baea8a34bcd48885 100644
--- a/src/parsing/parser-base.h
+++ b/src/parsing/parser-base.h
@@ -2573,6 +2573,7 @@ ParserBase<Impl>::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);
impl()->ReportMessageAt(sub_loc,
@@ -2592,6 +2593,12 @@ ParserBase<Impl>::ParseTailCallExpression(ExpressionClassifier* classifier,
*ok = false;
return impl()->EmptyExpression();
}
+ if (is_resumable()) {
+ Scanner::Location sub_loc(sub_expression_pos, loc.end_pos);
+ impl()->ReportMessageAt(sub_loc, MessageTemplate::kUnexpectedTailCall);
+ *ok = false;
+ return impl()->EmptyExpression();
+ }
ReturnExprContext return_expr_context =
function_state_->return_expr_context();
if (return_expr_context != ReturnExprContext::kInsideValidReturnStatement) {
« no previous file with comments | « src/parsing/parser.cc ('k') | test/message/syntactic-tail-call-generator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698