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

Unified Diff: src/parser.cc

Issue 1433743005: [cleanup] Remove un-scoped ParseBlock from Parser (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Change preparser to match Created 5 years, 1 month 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/parser.h ('k') | src/preparser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index 9227272e09ca51ed62dce91704ad6e940b7723e5..22efbac101d7586efeac9efcd826f9c2f7b67e1f 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -2352,34 +2352,6 @@ Statement* Parser::ParseClassDeclaration(ZoneList<const AstRawString*>* names,
Block* Parser::ParseBlock(ZoneList<const AstRawString*>* labels, bool* ok) {
- if (is_strict(language_mode()) || allow_harmony_sloppy()) {
- return ParseScopedBlock(labels, ok);
- }
-
- // Block ::
- // '{' Statement* '}'
-
- // Note that a Block does not introduce a new execution scope!
- // (ECMA-262, 3rd, 12.2)
- //
- // Construct block expecting 16 statements.
- Block* result =
- factory()->NewBlock(labels, 16, false, RelocInfo::kNoPosition);
- Target target(&this->target_stack_, result);
- Expect(Token::LBRACE, CHECK_OK);
- while (peek() != Token::RBRACE) {
- Statement* stat = ParseStatement(NULL, CHECK_OK);
- if (stat && !stat->IsEmpty()) {
- result->statements()->Add(stat, zone());
- }
- }
- Expect(Token::RBRACE, CHECK_OK);
- return result;
-}
-
-
-Block* Parser::ParseScopedBlock(ZoneList<const AstRawString*>* labels,
- bool* ok) {
// The harmony mode uses block elements instead of statements.
//
// Block ::
@@ -3190,7 +3162,7 @@ TryStatement* Parser::ParseTryStatement(bool* ok) {
{
BlockState block_state(&scope_, catch_scope);
- // TODO(adamk): Make a version of ParseScopedBlock that takes a scope and
+ // TODO(adamk): Make a version of ParseBlock that takes a scope and
// a block.
catch_block =
factory()->NewBlock(nullptr, 16, false, RelocInfo::kNoPosition);
@@ -4136,7 +4108,7 @@ DoExpression* Parser::ParseDoExpression(bool* ok) {
Expect(Token::DO, CHECK_OK);
Variable* result =
scope_->NewTemporary(ast_value_factory()->dot_result_string());
- Block* block = ParseScopedBlock(nullptr, CHECK_OK);
+ Block* block = ParseBlock(nullptr, CHECK_OK);
DoExpression* expr = factory()->NewDoExpression(block, result, pos);
if (!Rewriter::Rewrite(this, expr, ast_value_factory())) {
*ok = false;
« no previous file with comments | « src/parser.h ('k') | src/preparser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698