Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: src/ast/modules.cc

Issue 2223893004: [modules] Detect all indirect exports and represent them as such. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@modules-imports
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/ast/modules.cc
diff --git a/src/ast/modules.cc b/src/ast/modules.cc
index 3a1f2e4b7b57a3c7a4d3055ee7d7e9ff2777a90e..67f371faa7e0aaf30cc1ed7acf7f38249a75dbd9 100644
--- a/src/ast/modules.cc
+++ b/src/ast/modules.cc
@@ -80,6 +80,23 @@ 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 {

Powered by Google App Engine
This is Rietveld 408576698