Index: src/scopes.cc |
diff --git a/src/scopes.cc b/src/scopes.cc |
index ba2efb2bcc9e1d7c742780f0f9d586b81a70c6f8..963d539afb96e664e8b2f063a14f7e85ee03048f 100644 |
--- a/src/scopes.cc |
+++ b/src/scopes.cc |
@@ -394,12 +394,16 @@ Variable* Scope::LookupLocal(const AstRawString* name) { |
// Check context slot lookup. |
VariableMode mode; |
- VariableLocation location; |
+ VariableLocation location = VariableLocation::CONTEXT; |
InitializationFlag init_flag; |
MaybeAssignedFlag maybe_assigned_flag; |
- int index = |
- ScopeInfo::ContextSlotIndex(scope_info_, name_handle, &mode, &location, |
- &init_flag, &maybe_assigned_flag); |
+ int index = ScopeInfo::ContextSlotIndex(scope_info_, name_handle, &mode, |
+ &init_flag, &maybe_assigned_flag); |
+ if (index < 0) { |
+ location = VariableLocation::GLOBAL; |
+ index = ScopeInfo::ContextGlobalSlotIndex(scope_info_, name_handle, &mode, |
+ &init_flag, &maybe_assigned_flag); |
+ } |
if (index < 0) { |
// Check parameters. |
index = scope_info_->ParameterIndex(*name_handle); |