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

Unified Diff: src/parsing/preparser.cc

Issue 2164943002: Split NewScope into NewScope and NewScopeWithParent (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment Created 4 years, 5 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 72c8fd4d77605c7dc517b568881faf243a356753..cb19c525fe3fbfceb27e7bfb6665677a47d3aa1d 100644
--- a/src/parsing/preparser.cc
+++ b/src/parsing/preparser.cc
@@ -307,7 +307,7 @@ PreParser::Statement PreParser::ParseScopedStatement(bool legacy, bool* ok) {
(legacy && allow_harmony_restrictive_declarations())) {
return ParseSubStatement(kDisallowLabelledFunctionStatement, ok);
} else {
- Scope* body_scope = NewScope(scope(), BLOCK_SCOPE);
+ Scope* body_scope = NewScope(BLOCK_SCOPE);
BlockState block_state(&scope_state_, body_scope);
return ParseFunctionDeclaration(ok);
}
@@ -478,7 +478,7 @@ PreParser::Statement PreParser::ParseBlock(bool* ok) {
// Block ::
// '{' StatementList '}'
- Scope* block_scope = NewScope(scope(), BLOCK_SCOPE);
+ Scope* block_scope = NewScope(BLOCK_SCOPE);
Expect(Token::LBRACE, CHECK_OK);
Statement final = Statement::Default();
{
@@ -792,7 +792,7 @@ PreParser::Statement PreParser::ParseWithStatement(bool* ok) {
ParseExpression(true, CHECK_OK);
Expect(Token::RPAREN, CHECK_OK);
- Scope* with_scope = NewScope(scope(), WITH_SCOPE);
+ Scope* with_scope = NewScope(WITH_SCOPE);
BlockState block_state(&scope_state_, with_scope);
ParseScopedStatement(true, CHECK_OK);
return Statement::Default();
@@ -808,7 +808,7 @@ PreParser::Statement PreParser::ParseSwitchStatement(bool* ok) {
ParseExpression(true, CHECK_OK);
Expect(Token::RPAREN, CHECK_OK);
- Scope* cases_scope = NewScope(scope(), BLOCK_SCOPE);
+ Scope* cases_scope = NewScope(BLOCK_SCOPE);
{
BlockState cases_block_state(&scope_state_, cases_scope);
Expect(Token::LBRACE, CHECK_OK);
@@ -869,7 +869,7 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) {
// 'for' '(' Expression? ';' Expression? ';' Expression? ')' Statement
// Create an in-between scope for let-bound iteration variables.
- Scope* for_scope = NewScope(scope(), BLOCK_SCOPE);
+ Scope* for_scope = NewScope(BLOCK_SCOPE);
bool has_lexical = false;
BlockState block_state(&scope_state_, for_scope);
@@ -959,7 +959,7 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) {
}
Expect(Token::RPAREN, CHECK_OK);
- Scope* body_scope = NewScope(scope(), BLOCK_SCOPE);
+ Scope* body_scope = NewScope(BLOCK_SCOPE);
{
BlockState block_state(&scope_state_, body_scope);
ParseScopedStatement(true, CHECK_OK);
@@ -975,7 +975,7 @@ PreParser::Statement PreParser::ParseForStatement(bool* ok) {
// If there are let bindings, then condition and the next statement of the
// for loop must be parsed in a new scope.
Scope* inner_scope = scope();
- if (has_lexical) inner_scope = NewScope(for_scope, BLOCK_SCOPE);
+ if (has_lexical) inner_scope = NewScopeWithParent(for_scope, BLOCK_SCOPE);
{
BlockState block_state(&scope_state_, inner_scope);
@@ -1043,7 +1043,7 @@ PreParser::Statement PreParser::ParseTryStatement(bool* ok) {
if (tok == Token::CATCH) {
Consume(Token::CATCH);
Expect(Token::LPAREN, CHECK_OK);
- Scope* catch_scope = NewScope(scope(), CATCH_SCOPE);
+ Scope* catch_scope = NewScope(CATCH_SCOPE);
ExpressionClassifier pattern_classifier(this);
ParsePrimaryExpression(&pattern_classifier, CHECK_OK);
ValidateBindingPattern(&pattern_classifier, CHECK_OK);
@@ -1053,7 +1053,7 @@ PreParser::Statement PreParser::ParseTryStatement(bool* ok) {
collect_tail_call_expressions_scope(
function_state_, &tail_call_expressions_in_catch_block);
BlockState block_state(&scope_state_, catch_scope);
- Scope* block_scope = NewScope(scope(), BLOCK_SCOPE);
+ Scope* block_scope = NewScope(BLOCK_SCOPE);
{
BlockState block_state(&scope_state_, block_scope);
ParseBlock(CHECK_OK);
@@ -1231,7 +1231,7 @@ PreParserExpression PreParser::ParseClassLiteral(
}
LanguageMode class_language_mode = language_mode();
- Scope* scope = NewScope(this->scope(), BLOCK_SCOPE);
+ Scope* scope = NewScope(BLOCK_SCOPE);
BlockState block_state(&scope_state_, scope);
this->scope()->SetLanguageMode(
static_cast<LanguageMode>(class_language_mode | STRICT));
« 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