Index: src/parsing/pattern-rewriter.cc |
diff --git a/src/parsing/pattern-rewriter.cc b/src/parsing/pattern-rewriter.cc |
index 2810c3506b165c352ab5dfeeb413cc4c90756437..cb47b572166b3cb8ff551303d86f78c08782f285 100644 |
--- a/src/parsing/pattern-rewriter.cc |
+++ b/src/parsing/pattern-rewriter.cc |
@@ -147,7 +147,12 @@ void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) { |
// pre-resolve the proxy because it resides in the same scope as the |
// declaration. |
const AstRawString* name = pattern->raw_name(); |
- VariableProxy* proxy = parser_->NewUnresolved(name, descriptor_->mode); |
+ Scope* scope = IsLexicalVariableMode(descriptor_->mode) |
+ ? parser_->scope() |
+ : parser_->GetDeclarationScope(); |
+ VariableProxy* proxy = scope->NewUnresolved( |
adamk
2016/08/10 17:37:43
I think this should just be unconditionally create
|
+ factory(), name, parser_->scanner()->location().beg_pos, |
+ parser_->scanner()->location().end_pos); |
Declaration* declaration = factory()->NewVariableDeclaration( |
proxy, descriptor_->mode, descriptor_->scope, |
descriptor_->declaration_pos); |