Chromium Code Reviews| Index: src/ast/modules.h |
| diff --git a/src/ast/modules.h b/src/ast/modules.h |
| index c8f7aa37937a231312114dffd79b9d911b8a8308..ce9cd3711f71e0b99b3872a5b65bd0f4566c24b4 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,27 @@ 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_; |
| + ZoneList<const ModuleEntry*> special_exports_; |
| ZoneList<const ModuleEntry*> special_imports_; |
|
adamk
2016/08/24 18:06:09
Maybe add a TODO to use ZoneVector for these so th
|
| + 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 +133,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 |