Index: src/ast/scopes.cc |
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
index b74d7ab824f7c2c1e6f83d342fe71beaca43e820..2443063e2a7a00869287fcfa044faa929660eaa4 100644 |
--- a/src/ast/scopes.cc |
+++ b/src/ast/scopes.cc |
@@ -171,8 +171,8 @@ ModuleScope::ModuleScope(Isolate* isolate, Handle<ScopeInfo> scope_info, |
// Deserialize special exports. |
Handle<FixedArray> special_exports = handle(module_info->special_exports()); |
for (int i = 0, n = special_exports->length(); i < n; ++i) { |
- Handle<FixedArray> serialized_entry( |
- FixedArray::cast(special_exports->get(i)), isolate); |
+ Handle<ModuleInfoEntry> serialized_entry( |
+ ModuleInfoEntry::cast(special_exports->get(i)), isolate); |
module_descriptor_->AddSpecialExport( |
ModuleDescriptor::Entry::Deserialize(isolate, avfactory, |
serialized_entry), |
@@ -182,8 +182,8 @@ ModuleScope::ModuleScope(Isolate* isolate, Handle<ScopeInfo> scope_info, |
// Deserialize regular exports. |
Handle<FixedArray> regular_exports = handle(module_info->regular_exports()); |
for (int i = 0, n = regular_exports->length(); i < n; ++i) { |
- Handle<FixedArray> serialized_entry( |
- FixedArray::cast(regular_exports->get(i)), isolate); |
+ Handle<ModuleInfoEntry> serialized_entry( |
+ ModuleInfoEntry::cast(regular_exports->get(i)), isolate); |
module_descriptor_->AddRegularExport(ModuleDescriptor::Entry::Deserialize( |
isolate, avfactory, serialized_entry)); |
} |
@@ -829,7 +829,7 @@ Variable* DeclarationScope::DeclareParameter( |
const AstRawString* name, VariableMode mode, bool is_optional, bool is_rest, |
bool* is_duplicate, AstValueFactory* ast_value_factory) { |
DCHECK(!already_resolved_); |
- DCHECK(is_function_scope()); |
+ DCHECK(is_function_scope() || is_module_scope()); |
DCHECK(!has_rest_); |
DCHECK(!is_optional || !is_rest); |
Variable* var; |
@@ -1164,6 +1164,16 @@ DeclarationScope* Scope::GetClosureScope() { |
return scope->AsDeclarationScope(); |
} |
+ModuleScope* Scope::GetModuleScope() { |
+ Scope* scope = this; |
+ DCHECK(!scope->is_script_scope()); |
+ while (!scope->is_module_scope()) { |
+ scope = scope->outer_scope(); |
+ DCHECK_NOT_NULL(scope); |
+ } |
+ return scope->AsModuleScope(); |
+} |
+ |
DeclarationScope* Scope::GetReceiverScope() { |
Scope* scope = this; |
while (!scope->is_script_scope() && |