Index: src/parser.cc |
diff --git a/src/parser.cc b/src/parser.cc |
index 3e85c7a6ab4e32fc2b0a178859a1eb42468e319c..c2177bb218a46cf3f6c79b54e85d2384d9fa007c 100644 |
--- a/src/parser.cc |
+++ b/src/parser.cc |
@@ -1773,7 +1773,7 @@ Block* Parser::ParseVariableDeclarations( |
// For let/const declarations in harmony mode, we can also immediately |
// pre-resolve the proxy because it resides in the same scope as the |
// declaration. |
- Declare(name, mode, NULL, mode != VAR, CHECK_OK); |
+ VariableProxy* proxy = Declare(name, mode, NULL, mode != VAR, CHECK_OK); |
nvars++; |
if (declaration_scope->num_var_or_const() > kMaxNumFunctionLocals) { |
ReportMessageAt(scanner().location(), "too_many_variables", |
@@ -1828,6 +1828,11 @@ Block* Parser::ParseVariableDeclarations( |
if (decl_props != NULL) *decl_props = kHasInitializers; |
} |
+ // Record the end position of the initializer. |
+ if (proxy->var() != NULL) { |
+ proxy->var()->set_initializer_position(scanner().location().end_pos); |
+ } |
+ |
// Make sure that 'const x' and 'let x' initialize 'x' to undefined. |
if (value == NULL && needs_init) { |
value = GetLiteralUndefined(); |