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

Unified Diff: src/parsing/parser.cc

Issue 2232633002: Function name variable does not need a VariableDeclaration (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 4 years, 4 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') | test/cctest/test-parsing.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 59d31f5a73514fd5c8a7f98d8e4be9146f8f433f..1d19e42c9e7ccb6810fdda788cd1d17d9dbc3232 100644
--- a/src/parsing/parser.cc
+++ b/src/parsing/parser.cc
@@ -4932,19 +4932,8 @@ ZoneList<Statement*>* Parser::ParseEagerFunctionBody(
if (function_type == FunctionLiteral::kNamedExpression) {
// Now that we know the language mode, we can create the const assignment
// in the previously reserved spot.
- // NOTE: We create a proxy and resolve it here so that in the
- // future we can change the AST to only refer to VariableProxies
- // instead of Variables and Proxies as is the case now.
DCHECK_EQ(function_scope, scope());
- VariableMode fvar_mode = is_strict(language_mode()) ? CONST : CONST_LEGACY;
- Variable* fvar = new (zone())
- Variable(scope(), function_name, fvar_mode, Variable::NORMAL,
- kCreatedInitialized, kNotAssigned);
- VariableProxy* proxy = factory()->NewVariableProxy(fvar);
- VariableDeclaration* fvar_declaration =
- factory()->NewVariableDeclaration(proxy, scope(), kNoSourcePosition);
- function_scope->DeclareFunctionVar(fvar_declaration);
-
+ Variable* fvar = function_scope->DeclareFunctionVar(function_name);
VariableProxy* fproxy = factory()->NewVariableProxy(fvar);
result->Set(kFunctionNameAssignmentIndex,
factory()->NewExpressionStatement(
« no previous file with comments | « src/ast/scopes.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698