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

Unified Diff: src/parser.cc

Issue 379893002: Clean up and update const / var (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index f37eae5d379156947d316b44ae9da162f558f812..0b9416cf574b9f798935d68b92d520a4cece4714 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -2186,21 +2186,22 @@ Block* Parser::ParseVariableDeclarations(
if (value != NULL && !inside_with()) {
arguments->Add(value, zone());
value = NULL; // zap the value to avoid the unnecessary assignment
+ // Construct the call to Runtime_InitializeVarGlobal
+ // and add it to the initialization statement block.
+ initialize = factory()->NewCallRuntime(
+ ast_value_factory_->initialize_var_global_string(),
+ Runtime::FunctionForId(Runtime::kInitializeVarGlobal), arguments,
+ pos);
+ } else {
+ initialize = NULL;
}
-
- // Construct the call to Runtime_InitializeVarGlobal
- // and add it to the initialization statement block.
- // Note that the function does different things depending on
- // the number of arguments (2 or 3).
- initialize = factory()->NewCallRuntime(
- ast_value_factory_->initialize_var_global_string(),
- Runtime::FunctionForId(Runtime::kInitializeVarGlobal),
- arguments, pos);
}
- block->AddStatement(
- factory()->NewExpressionStatement(initialize, RelocInfo::kNoPosition),
- zone());
+ if (initialize != NULL) {
+ block->AddStatement(factory()->NewExpressionStatement(
+ initialize, RelocInfo::kNoPosition),
+ zone());
+ }
} else if (needs_init) {
// Constant initializations always assign to the declared constant which
// is always at the function scope level. This is only relevant for

Powered by Google App Engine
This is Rietveld 408576698