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

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

Issue 2315043002: 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 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after
2493 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos); 2493 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos);
2494 ReportMessageAt(sub_loc, MessageTemplate::kUnexpectedTailCallOfEval); 2494 ReportMessageAt(sub_loc, MessageTemplate::kUnexpectedTailCallOfEval);
2495 *ok = false; 2495 *ok = false;
2496 return Traits::EmptyExpression(); 2496 return Traits::EmptyExpression();
2497 } 2497 }
2498 if (!is_strict(language_mode())) { 2498 if (!is_strict(language_mode())) {
2499 ReportMessageAt(loc, MessageTemplate::kUnexpectedSloppyTailCall); 2499 ReportMessageAt(loc, MessageTemplate::kUnexpectedSloppyTailCall);
2500 *ok = false; 2500 *ok = false;
2501 return Traits::EmptyExpression(); 2501 return Traits::EmptyExpression();
2502 } 2502 }
2503 if (is_resumable()) {
2504 Scanner::Location sub_loc(sub_expression_pos, loc.end_pos);
2505 ReportMessageAt(sub_loc, MessageTemplate::kUnexpectedTailCall);
2506 *ok = false;
2507 return Traits::EmptyExpression();
2508 }
2503 ReturnExprContext return_expr_context = 2509 ReturnExprContext return_expr_context =
2504 function_state_->return_expr_context(); 2510 function_state_->return_expr_context();
2505 if (return_expr_context != ReturnExprContext::kInsideValidReturnStatement) { 2511 if (return_expr_context != ReturnExprContext::kInsideValidReturnStatement) {
2506 MessageTemplate::Template msg = MessageTemplate::kNone; 2512 MessageTemplate::Template msg = MessageTemplate::kNone;
2507 switch (return_expr_context) { 2513 switch (return_expr_context) {
2508 case ReturnExprContext::kInsideValidReturnStatement: 2514 case ReturnExprContext::kInsideValidReturnStatement:
2509 UNREACHABLE(); 2515 UNREACHABLE();
2510 return Traits::EmptyExpression(); 2516 return Traits::EmptyExpression();
2511 case ReturnExprContext::kInsideValidBlock: 2517 case ReturnExprContext::kInsideValidBlock:
2512 msg = MessageTemplate::kUnexpectedTailCall; 2518 msg = MessageTemplate::kUnexpectedTailCall;
(...skipping 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
3636 has_seen_constructor_ = true; 3642 has_seen_constructor_ = true;
3637 return; 3643 return;
3638 } 3644 }
3639 } 3645 }
3640 3646
3641 3647
3642 } // namespace internal 3648 } // namespace internal
3643 } // namespace v8 3649 } // namespace v8
3644 3650
3645 #endif // V8_PARSING_PARSER_BASE_H 3651 #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