Index: src/contexts.cc |
diff --git a/src/contexts.cc b/src/contexts.cc |
index 9f39aecd542ca24dbbad3bf7baf1109e853494ba..6bd4fcef11053c6285e02b1a98adda3e4afaf20a 100644 |
--- a/src/contexts.cc |
+++ b/src/contexts.cc |
@@ -56,6 +56,19 @@ bool ScriptContextTable::Lookup(Handle<ScriptContextTable> table, |
} |
+bool ScriptContextTable::LookupLexical(Handle<ScriptContextTable> table, |
+ Handle<String> name) { |
+ for (int i = 0; i < table->used(); i++) { |
+ Handle<Context> context = GetContext(table, i); |
+ DCHECK(context->IsScriptContext()); |
+ Handle<ScopeInfo> scope_info(ScopeInfo::cast(context->extension())); |
+ int slot_index = ScopeInfo::LexicalContextSlotIndex(scope_info, name); |
+ if (slot_index >= 0) return true; |
+ } |
+ return false; |
+} |
+ |
+ |
Context* Context::declaration_context() { |
Context* current = this; |
while (!current->IsFunctionContext() && !current->IsNativeContext() && |