Index: src/ast/modules.h |
diff --git a/src/ast/modules.h b/src/ast/modules.h |
index 4c63df9dfad2569125bb34b3fa309c0f03f0430b..a3bbb09a26832a7f94ac08d106f813fb46cc537f 100644 |
--- a/src/ast/modules.h |
+++ b/src/ast/modules.h |
@@ -62,6 +62,24 @@ class ModuleDescriptor : public ZoneObject { |
const AstRawString* module_request, const Scanner::Location loc, |
Zone* zone); |
+ // Find any implicitly indirect exports and make them explicit. |
+ // |
+ // An explicitly indirect export is an export entry arising from an export |
+ // statement of the following form: |
+ // export {a as c} from "X"; |
+ // An implicitly indirect export corresponds to |
+ // export {b as c}; |
+ // in the presence of an import statement of the form |
+ // import {a as b} from "X"; |
+ // This function finds such implicitly indirect export entries and rewrites |
+ // them by filling in the import name and module request, as well as nulling |
+ // out the local name. Effectively, it turns |
+ // import {a as b} from "X"; export {b as c}; |
+ // into: |
+ // import {a as b} from "X"; export {a as c} from "X"; |
+ // (The import entry is never deleted.) |
+ void MakeIndirectExportsExplicit(); |
+ |
// Check if module is well-formed and report error if not. |
bool Validate(DeclarationScope* module_scope, |
PendingCompilationErrorHandler* error_handler, |
@@ -82,7 +100,7 @@ class ModuleDescriptor : public ZoneObject { |
module_request(nullptr) {} |
}; |
- const ZoneList<const ModuleEntry*>& exports() const { return exports_; } |
+ const ZoneList<ModuleEntry*>& exports() const { return exports_; } |
adamk
2016/08/09 16:52:51
Maybe remove the const-ness of this method? I real
neis
2016/08/10 11:53:30
I don't understand, it's just a getter.
adamk
2016/08/10 17:30:28
But it now lets callers mutate the internal state
|
// Empty imports and namespace imports. |
const ZoneList<const ModuleEntry*>& special_imports() const { |
@@ -96,7 +114,7 @@ class ModuleDescriptor : public ZoneObject { |
} |
private: |
- ZoneList<const ModuleEntry*> exports_; |
+ ZoneList<ModuleEntry*> exports_; |
ZoneList<const ModuleEntry*> special_imports_; |
ZoneMap<const AstRawString*, const ModuleEntry*> regular_imports_; |
}; |