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

Unified Diff: src/parsing/preparser.cc

Issue 2339453002: [parser] Refactor of Parse*Statement*, part 7 (Closed)
Patch Set: Change in comment 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/preparser.cc
diff --git a/src/parsing/preparser.cc b/src/parsing/preparser.cc
index 9161a1a49a26fd87d4a362611d22fd8a7e42dea8..9dffa836e90edd906151368c43ea2447aa4b9bea 100644
--- a/src/parsing/preparser.cc
+++ b/src/parsing/preparser.cc
@@ -298,72 +298,6 @@ PreParser::Statement PreParser::ParseForStatement(
}
-PreParser::Statement PreParser::ParseTryStatement(bool* ok) {
- // TryStatement ::
- // 'try' Block Catch
- // 'try' Block Finally
- // 'try' Block Catch Finally
- //
- // Catch ::
- // 'catch' '(' Identifier ')' Block
- //
- // Finally ::
- // 'finally' Block
-
- Expect(Token::TRY, CHECK_OK);
-
- {
- ReturnExprScope no_tail_calls(function_state_,
- ReturnExprContext::kInsideTryBlock);
- ParseBlock(nullptr, CHECK_OK);
- }
-
- Token::Value tok = peek();
- if (tok != Token::CATCH && tok != Token::FINALLY) {
- ReportMessageAt(scanner()->location(), MessageTemplate::kNoCatchOrFinally);
- *ok = false;
- return Statement::Default();
- }
- TailCallExpressionList tail_call_expressions_in_catch_block(zone());
- bool catch_block_exists = false;
- if (tok == Token::CATCH) {
- Consume(Token::CATCH);
- Expect(Token::LPAREN, CHECK_OK);
- Scope* catch_scope = NewScope(CATCH_SCOPE);
- ExpressionClassifier pattern_classifier(this);
- ParsePrimaryExpression(CHECK_OK);
- ValidateBindingPattern(CHECK_OK);
- Expect(Token::RPAREN, CHECK_OK);
- {
- CollectExpressionsInTailPositionToListScope
- collect_tail_call_expressions_scope(
- function_state_, &tail_call_expressions_in_catch_block);
- BlockState block_state(&scope_state_, catch_scope);
- {
- BlockState block_state(&scope_state_);
- ParseBlock(nullptr, CHECK_OK);
- }
- }
- catch_block_exists = true;
- tok = peek();
- }
- if (tok == Token::FINALLY) {
- Consume(Token::FINALLY);
- ParseBlock(nullptr, CHECK_OK);
- if (FLAG_harmony_explicit_tailcalls && catch_block_exists &&
- tail_call_expressions_in_catch_block.has_explicit_tail_calls()) {
- // TODO(ishell): update chapter number.
- // ES8 XX.YY.ZZ
- ReportMessageAt(tail_call_expressions_in_catch_block.location(),
- MessageTemplate::kUnexpectedTailCallInCatchBlock);
- *ok = false;
- return Statement::Default();
- }
- }
- return Statement::Default();
-}
-
-
// Redefinition of CHECK_OK for parsing expressions.
#undef CHECK_OK
#define CHECK_OK CHECK_OK_VALUE(Expression::Default())
« no previous file with comments | « src/parsing/preparser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698