Index: src/parser.cc |
diff --git a/src/parser.cc b/src/parser.cc |
index 67bae43be155899c8736e4752c8c07e0d7c3a934..46dc4b009ae4d3f96eb4b680950047129288bc60 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(); |