Index: src/contexts.cc |
diff --git a/src/contexts.cc b/src/contexts.cc |
index ea4730042fc468ed0623b9a0198a6e095411895c..0147296bf8846f6e851561b874e7bd0cdad1d125 100644 |
--- a/src/contexts.cc |
+++ b/src/contexts.cc |
@@ -57,7 +57,8 @@ bool ScriptContextTable::Lookup(Handle<ScriptContextTable> table, |
bool Context::is_declaration_context() { |
- if (IsFunctionContext() || IsNativeContext() || IsScriptContext()) { |
+ if (IsFunctionContext() || IsNativeContext() || IsScriptContext() || |
+ IsModuleContext()) { |
return true; |
} |
if (!IsBlockContext()) return false; |
@@ -110,7 +111,7 @@ JSReceiver* Context::extension_receiver() { |
ScopeInfo* Context::scope_info() { |
- DCHECK(IsModuleContext() || IsScriptContext() || IsBlockContext()); |
+ DCHECK(IsScriptContext() || IsBlockContext()); |
HeapObject* object = extension(); |
if (object->IsContextExtension()) { |
DCHECK(IsBlockContext()); |
@@ -119,6 +120,13 @@ ScopeInfo* Context::scope_info() { |
return ScopeInfo::cast(object); |
} |
+JSModule* Context::module() { |
+ Context* current = this; |
+ while (!current->IsModuleContext()) { |
+ current = current->previous(); |
+ } |
+ return JSModule::cast(current->extension()); |
+} |
String* Context::catch_name() { |
DCHECK(IsCatchContext()); |
@@ -185,6 +193,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); |