Index: src/contexts.cc |
diff --git a/src/contexts.cc b/src/contexts.cc |
index dc4c0bd2c6f659775d734db0f6187eb80ebf2c16..86ab3b6283d61d43e3a8142747e5ae7678ca41d4 100644 |
--- a/src/contexts.cc |
+++ b/src/contexts.cc |
@@ -79,6 +79,15 @@ Context* Context::declaration_context() { |
return current; |
} |
+Context* Context::local_context() { |
+ Context* current = this; |
+ while (!current->IsFunctionContext() && !current->IsScriptContext() && |
+ !current->IsNativeContext()) { |
+ current = current->previous(); |
+ DCHECK(current->closure() == closure()); |
+ } |
+ return current; |
+} |
JSObject* Context::extension_object() { |
DCHECK(IsNativeContext() || IsFunctionContext() || IsBlockContext()); |