Index: src/ast/scopes.cc |
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
index 1eda493d6e5d7880e709824e659c4958319a2cca..946f304b940ee831d3ba8950ebf0467a7c6d7266 100644 |
--- a/src/ast/scopes.cc |
+++ b/src/ast/scopes.cc |
@@ -842,6 +842,22 @@ void Scope::GetNestedScopeChain(Isolate* isolate, |
} |
+void Scope::CollectNonLocals(HashMap* non_locals) { |
+ // Collect non-local variables referenced in the scope. |
+ for (int i = 0; i < unresolved_.length(); i++) { |
rossberg
2015/12/09 14:53:46
This scares me! It assumes that all non-locals are
|
+ VariableProxy* proxy = unresolved_[i]; |
+ if (proxy->is_resolved() && proxy->var()->IsStackAllocated()) continue; |
+ Handle<String> name = proxy->name(); |
+ void* key = reinterpret_cast<void*>(name.location()); |
+ HashMap::Entry* entry = non_locals->LookupOrInsert(key, name->Hash()); |
+ entry->value = key; |
+ } |
+ for (int i = 0; i < inner_scopes_.length(); i++) { |
+ inner_scopes_[i]->CollectNonLocals(non_locals); |
+ } |
+} |
+ |
+ |
void Scope::ReportMessage(int start_position, int end_position, |
MessageTemplate::Template message, |
const AstRawString* arg) { |