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

Unified Diff: src/parsing/parser.cc

Issue 2349193002: Don't make immediately resolved proxies unresolved (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/scopes.cc ('k') | src/parsing/pattern-rewriter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parsing/parser.cc
diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc
index 56e3e0a7c89d97328dd18efe41c5775fcc57a234..06b5001134a5a842202ad1ec759007c7b0a0aae7 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -1485,11 +1485,9 @@ Declaration* Parser::DeclareVariable(const AstRawString* name,
VariableMode mode, InitializationFlag init,
int pos, bool* ok) {
DCHECK_NOT_NULL(name);
- Scope* scope =
- IsLexicalVariableMode(mode) ? this->scope() : GetDeclarationScope();
- VariableProxy* proxy =
- scope->NewUnresolved(factory(), name, scanner()->location().beg_pos,
- scanner()->location().end_pos);
+ VariableProxy* proxy = factory()->NewVariableProxy(
+ name, NORMAL_VARIABLE, scanner()->location().beg_pos,
+ scanner()->location().end_pos);
Declaration* declaration =
factory()->NewVariableDeclaration(proxy, this->scope(), pos);
Declare(declaration, DeclarationDescriptor::NORMAL, mode, init, CHECK_OK);
@@ -1656,7 +1654,8 @@ Statement* Parser::DeclareFunction(const AstRawString* variable_name,
VariableMode mode =
(!scope()->is_declaration_scope() || scope()->is_module_scope()) ? LET
: VAR;
- VariableProxy* proxy = NewUnresolved(variable_name);
+ VariableProxy* proxy =
+ factory()->NewVariableProxy(variable_name, NORMAL_VARIABLE);
Declaration* declaration =
factory()->NewFunctionDeclaration(proxy, function, scope(), pos);
Declare(declaration, DeclarationDescriptor::NORMAL, mode, kCreatedInitialized,
@@ -3857,7 +3856,7 @@ Expression* Parser::ParseClassLiteral(const AstRawString* name,
VariableProxy* proxy = nullptr;
if (name != nullptr) {
- proxy = NewUnresolved(name);
+ proxy = factory()->NewVariableProxy(name, NORMAL_VARIABLE);
// TODO(verwaest): declare via block_state.
Declaration* declaration =
factory()->NewVariableDeclaration(proxy, block_state.scope(), pos);
@@ -3941,7 +3940,8 @@ Expression* Parser::ParseClassLiteral(const AstRawString* name,
//}
const AstRawString* name = ClassFieldVariableName(
true, ast_value_factory(), instance_field_initializers->length());
- VariableProxy* name_proxy = NewUnresolved(name);
+ VariableProxy* name_proxy =
+ factory()->NewVariableProxy(name, NORMAL_VARIABLE);
Declaration* name_declaration = factory()->NewVariableDeclaration(
name_proxy, scope(), kNoSourcePosition);
Variable* name_var =
@@ -4022,7 +4022,8 @@ Expression* Parser::ParseClassLiteral(const AstRawString* name,
for (int i = 0; i < instance_field_initializers->length(); ++i) {
const AstRawString* function_name =
ClassFieldVariableName(false, ast_value_factory(), i);
- VariableProxy* function_proxy = NewUnresolved(function_name);
+ VariableProxy* function_proxy =
+ factory()->NewVariableProxy(function_name, NORMAL_VARIABLE);
Declaration* function_declaration = factory()->NewVariableDeclaration(
function_proxy, scope(), kNoSourcePosition);
Variable* function_var =
« no previous file with comments | « src/ast/scopes.cc ('k') | src/parsing/pattern-rewriter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698