Index: src/contexts.cc |
diff --git a/src/contexts.cc b/src/contexts.cc |
index 0822e45cd0ed71e4a878acf92ba84da04f67760d..7db29766c637794000ca438e23a6af8748a294ce 100644 |
--- a/src/contexts.cc |
+++ b/src/contexts.cc |
@@ -110,7 +110,7 @@ JSReceiver* Context::extension_receiver() { |
ScopeInfo* Context::scope_info() { |
- DCHECK(IsModuleContext() || IsScriptContext() || IsBlockContext()); |
+ DCHECK(IsScriptContext() || IsBlockContext()); |
HeapObject* object = extension(); |
if (object->IsSloppyBlockWithEvalContextExtension()) { |
DCHECK(IsBlockContext()); |
@@ -120,6 +120,16 @@ ScopeInfo* Context::scope_info() { |
} |
+JSModule* Context::module() { |
+ Context* current = this; |
+ while (!current->IsModuleContext()) { |
+ current = current->previous(); |
+ DCHECK_NOT_NULL(current); // XXX |
adamk
2016/09/01 23:13:34
In our offline discussion I said this was a bit bo
neis
2016/09/02 11:32:58
Done.
|
+ } |
+ return JSModule::cast(current->extension()); |
+} |
+ |
+ |
String* Context::catch_name() { |
DCHECK(IsCatchContext()); |
return String::cast(extension()); |
@@ -185,6 +195,7 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags, |
int* index, PropertyAttributes* attributes, |
InitializationFlag* init_flag, |
VariableMode* variable_mode) { |
+ DCHECK(!IsModuleContext()); |
Isolate* isolate = GetIsolate(); |
Handle<Context> context(this, isolate); |