Index: src/ast/modules.cc |
diff --git a/src/ast/modules.cc b/src/ast/modules.cc |
index 3a1f2e4b7b57a3c7a4d3055ee7d7e9ff2777a90e..a5ef69e1bbfdb6a45a86d14680ffcb3b336b26b1 100644 |
--- a/src/ast/modules.cc |
+++ b/src/ast/modules.cc |
@@ -80,9 +80,26 @@ void ModuleDescriptor::AddStarExport( |
exports_.Add(entry, zone); |
} |
+void ModuleDescriptor::MakeIndirectExportsExplicit() { |
+ for (auto entry : exports_) { |
+ if (entry->export_name == nullptr) continue; |
+ if (entry->import_name != nullptr) continue; |
+ DCHECK_NOT_NULL(entry->local_name); |
+ auto it = regular_imports_.find(entry->local_name); |
+ if (it != regular_imports_.end()) { |
+ // Found an indirect export. |
+ DCHECK_NOT_NULL(it->second->module_request); |
+ DCHECK_NOT_NULL(it->second->import_name); |
+ entry->import_name = it->second->import_name; |
+ entry->module_request = it->second->module_request; |
+ entry->local_name = nullptr; |
+ } |
+ } |
+} |
+ |
bool ModuleDescriptor::Validate(DeclarationScope* module_scope, |
PendingCompilationErrorHandler* error_handler, |
- Zone* zone) const { |
+ Zone* zone) { |
DCHECK(module_scope->is_module_scope()); |
DCHECK_EQ(this, module_scope->module()); |
DCHECK_NOT_NULL(error_handler); |
@@ -120,6 +137,7 @@ bool ModuleDescriptor::Validate(DeclarationScope* module_scope, |
} |
} |
+ MakeIndirectExportsExplicit(); |
return true; |
} |