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

Unified Diff: src/ast/modules.h

Issue 2273013002: [modules] Split exports into regular and special, store regular ones in a multimap. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git cl format 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
« no previous file with comments | « no previous file | src/ast/modules.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/modules.h
diff --git a/src/ast/modules.h b/src/ast/modules.h
index c8f7aa37937a231312114dffd79b9d911b8a8308..dc6da8eb597bfe02e4238de7f7a678a5dd05a639 100644
--- a/src/ast/modules.h
+++ b/src/ast/modules.h
@@ -19,7 +19,10 @@ class AstRawString;
class ModuleDescriptor : public ZoneObject {
public:
explicit ModuleDescriptor(Zone* zone)
- : exports_(1, zone), special_imports_(1, zone), regular_imports_(zone) {}
+ : special_exports_(1, zone),
+ special_imports_(1, zone),
+ regular_exports_(zone),
+ regular_imports_(zone) {}
// import x from "foo.js";
// import {x} from "foo.js";
@@ -82,8 +85,6 @@ class ModuleDescriptor : public ZoneObject {
module_request(nullptr) {}
};
- const ZoneList<ModuleEntry*>& exports() const { return exports_; }
-
// Empty imports and namespace imports.
const ZoneList<const ModuleEntry*>& special_imports() const {
return special_imports_;
@@ -95,11 +96,28 @@ class ModuleDescriptor : public ZoneObject {
return regular_imports_;
}
+ // Star exports and explicitly indirect exports.
+ const ZoneList<const ModuleEntry*>& special_exports() const {
+ return special_exports_;
+ }
+
+ // All the remaining exports, indexed by local name.
+ const ZoneMultimap<const AstRawString*, ModuleEntry*>& regular_exports()
+ const {
+ return regular_exports_;
+ }
+
private:
- ZoneList<ModuleEntry*> exports_;
+ // TODO(neis): Use STL datastructure instead of ZoneList?
+ ZoneList<const ModuleEntry*> special_exports_;
ZoneList<const ModuleEntry*> special_imports_;
+ ZoneMultimap<const AstRawString*, ModuleEntry*> regular_exports_;
ZoneMap<const AstRawString*, const ModuleEntry*> regular_imports_;
+ // If there are multiple export entries with the same export name, return one
+ // of them. Otherwise return nullptr.
+ const ModuleEntry* FindDuplicateExport(Zone* zone) const;
+
// Find any implicitly indirect exports and make them explicit.
//
// An explicitly indirect export is an export entry arising from an export
@@ -116,7 +134,7 @@ class ModuleDescriptor : public ZoneObject {
// into:
// import {a as b} from "X"; export {a as c} from "X";
// (The import entry is never deleted.)
- void MakeIndirectExportsExplicit();
+ void MakeIndirectExportsExplicit(Zone* zone);
};
} // namespace internal
« no previous file with comments | « no previous file | src/ast/modules.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698