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

Unified Diff: src/ast/modules.h

Issue 2224333002: [modules] Split imports into regular and special, store regular ones in a map. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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
« 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 315f5281f724c90c1969c39182edb3876d5f3cd5..4c63df9dfad2569125bb34b3fa309c0f03f0430b 100644
--- a/src/ast/modules.h
+++ b/src/ast/modules.h
@@ -7,7 +7,7 @@
#include "src/parsing/scanner.h" // Only for Scanner::Location.
#include "src/pending-compilation-error-handler.h"
-#include "src/zone.h"
+#include "src/zone-containers.h"
namespace v8 {
namespace internal {
@@ -19,7 +19,7 @@ class AstRawString;
class ModuleDescriptor : public ZoneObject {
public:
explicit ModuleDescriptor(Zone* zone)
- : exports_(1, zone), imports_(1, zone) {}
+ : exports_(1, zone), special_imports_(1, zone), regular_imports_(zone) {}
// import x from "foo.js";
// import {x} from "foo.js";
@@ -82,12 +82,23 @@ class ModuleDescriptor : public ZoneObject {
module_request(nullptr) {}
};
- const ZoneList<const ModuleEntry*>& exports() { return exports_; }
- const ZoneList<const ModuleEntry*>& imports() { return imports_; }
+ const ZoneList<const ModuleEntry*>& exports() const { return exports_; }
+
+ // Empty imports and namespace imports.
+ const ZoneList<const ModuleEntry*>& special_imports() const {
+ return special_imports_;
+ }
+
+ // All the remaining imports, indexed by local name.
+ const ZoneMap<const AstRawString*, const ModuleEntry*>& regular_imports()
+ const {
+ return regular_imports_;
+ }
private:
ZoneList<const ModuleEntry*> exports_;
- ZoneList<const ModuleEntry*> imports_;
+ ZoneList<const ModuleEntry*> special_imports_;
+ ZoneMap<const AstRawString*, const ModuleEntry*> regular_imports_;
};
} // 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