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

Side by Side Diff: src/parsing/parser-base.h

Issue 2316623004: Merged: Disallow tail calls from async functions and generators (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/parsing/parser.cc ('k') | test/mjsunit/es8/syntactic-tail-call-parsing.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PARSING_PARSER_BASE_H 5 #ifndef V8_PARSING_PARSER_BASE_H
6 #define V8_PARSING_PARSER_BASE_H 6 #define V8_PARSING_PARSER_BASE_H
7 7
8 #include "src/ast/scopes.h" 8 #include "src/ast/scopes.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/base/hashmap.h" 10 #include "src/base/hashmap.h"
(...skipping 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2598 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos); 2598 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos);
2599 ReportMessageAt(sub_loc, MessageTemplate::kUnexpectedTailCallOfEval); 2599 ReportMessageAt(sub_loc, MessageTemplate::kUnexpectedTailCallOfEval);
2600 *ok = false; 2600 *ok = false;
2601 return Traits::EmptyExpression(); 2601 return Traits::EmptyExpression();
2602 } 2602 }
2603 if (!is_strict(language_mode())) { 2603 if (!is_strict(language_mode())) {
2604 ReportMessageAt(loc, MessageTemplate::kUnexpectedSloppyTailCall); 2604 ReportMessageAt(loc, MessageTemplate::kUnexpectedSloppyTailCall);
2605 *ok = false; 2605 *ok = false;
2606 return Traits::EmptyExpression(); 2606 return Traits::EmptyExpression();
2607 } 2607 }
2608 if (is_resumable()) {
2609 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos);
2610 ReportMessageAt(sub_loc, MessageTemplate::kUnexpectedTailCall);
2611 *ok = false;
2612 return Traits::EmptyExpression();
2613 }
2608 ReturnExprContext return_expr_context = 2614 ReturnExprContext return_expr_context =
2609 function_state_->return_expr_context(); 2615 function_state_->return_expr_context();
2610 if (return_expr_context != ReturnExprContext::kInsideValidReturnStatement) { 2616 if (return_expr_context != ReturnExprContext::kInsideValidReturnStatement) {
2611 MessageTemplate::Template msg = MessageTemplate::kNone; 2617 MessageTemplate::Template msg = MessageTemplate::kNone;
2612 switch (return_expr_context) { 2618 switch (return_expr_context) {
2613 case ReturnExprContext::kInsideValidReturnStatement: 2619 case ReturnExprContext::kInsideValidReturnStatement:
2614 UNREACHABLE(); 2620 UNREACHABLE();
2615 return Traits::EmptyExpression(); 2621 return Traits::EmptyExpression();
2616 case ReturnExprContext::kInsideValidBlock: 2622 case ReturnExprContext::kInsideValidBlock:
2617 msg = MessageTemplate::kUnexpectedTailCall; 2623 msg = MessageTemplate::kUnexpectedTailCall;
(...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after
3725 has_seen_constructor_ = true; 3731 has_seen_constructor_ = true;
3726 return; 3732 return;
3727 } 3733 }
3728 } 3734 }
3729 3735
3730 3736
3731 } // namespace internal 3737 } // namespace internal
3732 } // namespace v8 3738 } // namespace v8
3733 3739
3734 #endif // V8_PARSING_PARSER_BASE_H 3740 #endif // V8_PARSING_PARSER_BASE_H
OLDNEW
« no previous file with comments | « src/parsing/parser.cc ('k') | test/mjsunit/es8/syntactic-tail-call-parsing.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698