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

Unified Diff: src/ast/modules.h

Issue 2368613002: [modules] Simplify treatment of empty imports. (Closed)
Patch Set: Created 4 years, 3 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 a7d674144b8ea4e71844fdf4d299e0ca368b99c9..4d36735fa804f1ed2b5f1ef89067fe1bc57c7e93 100644
--- a/src/ast/modules.h
+++ b/src/ast/modules.h
@@ -21,7 +21,7 @@ class ModuleDescriptor : public ZoneObject {
explicit ModuleDescriptor(Zone* zone)
: module_requests_(zone),
special_exports_(1, zone),
- special_imports_(1, zone),
+ namespace_imports_(1, zone),
regular_exports_(zone),
regular_imports_(zone) {}
@@ -44,9 +44,7 @@ class ModuleDescriptor : public ZoneObject {
// import "foo.js";
// import {} from "foo.js";
// export {} from "foo.js"; (sic!)
- void AddEmptyImport(
- const AstRawString* module_request, const Scanner::Location loc,
- Zone* zone);
+ void AddEmptyImport(const AstRawString* module_request);
// export {x};
// export {x as y};
@@ -106,9 +104,9 @@ class ModuleDescriptor : public ZoneObject {
return module_requests_;
}
- // Empty imports and namespace imports.
- const ZoneList<const Entry*>& special_imports() const {
- return special_imports_;
+ // Namespace imports.
+ const ZoneList<const Entry*>& namespace_imports() const {
+ return namespace_imports_;
}
// All the remaining imports, indexed by local name.
@@ -151,10 +149,12 @@ class ModuleDescriptor : public ZoneObject {
// case we will report an error when declaring the variable.
}
- void AddSpecialImport(const Entry* entry, Zone* zone) {
+ void AddNamespaceImport(const Entry* entry, Zone* zone) {
+ DCHECK_NULL(entry->import_name);
DCHECK_NULL(entry->export_name);
+ DCHECK_NOT_NULL(entry->local_name);
DCHECK_LE(0, entry->module_request);
- special_imports_.Add(entry, zone);
+ namespace_imports_.Add(entry, zone);
}
Handle<FixedArray> SerializeRegularExports(Isolate* isolate,
@@ -166,7 +166,7 @@ class ModuleDescriptor : public ZoneObject {
// TODO(neis): Use STL datastructure instead of ZoneList?
ZoneMap<const AstRawString*, int> module_requests_;
ZoneList<const Entry*> special_exports_;
- ZoneList<const Entry*> special_imports_;
+ ZoneList<const Entry*> namespace_imports_;
ZoneMultimap<const AstRawString*, Entry*> regular_exports_;
ZoneMap<const AstRawString*, const Entry*> regular_imports_;
« 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