Index: src/parsing/pattern-rewriter.cc |
diff --git a/src/parsing/pattern-rewriter.cc b/src/parsing/pattern-rewriter.cc |
index edd283e9d62f7a484b4f16a7149b0ab4d7903ae2..9eb3f0665be3030344a7fc4522310b6159eb2e77 100644 |
--- a/src/parsing/pattern-rewriter.cc |
+++ b/src/parsing/pattern-rewriter.cc |
@@ -224,6 +224,14 @@ void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) { |
} else { |
DCHECK_NOT_NULL(proxy); |
DCHECK_NOT_NULL(proxy->var()); |
+ if (var_init_scope->is_script_scope() || |
+ var_init_scope->is_module_scope()) { |
+ // We have to pessimistically assume that top-level variables will be |
+ // assigned. This is because there may be lazily parsed top-level |
adamk
2017/01/17 18:09:04
As discussed offline, this comment is slightly mis
|
+ // functions, which, for efficiency, we preparse without variable |
+ // tracking. |
+ proxy->set_is_assigned(); |
+ } |
} |
// Add break location for destructured sub-pattern. |
int pos = IsSubPattern() ? pattern->position() : value->position(); |