Index: src/contexts.cc |
diff --git a/src/contexts.cc b/src/contexts.cc |
index d4910eac03d6bf38a607d7c5f992b5907fc52a0e..a08fd04dbb7002c0280ed94a47765a8d82ee5604 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; |
@@ -123,6 +124,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()); |
@@ -189,6 +197,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); |