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

Unified Diff: src/ast/modules.h

Issue 2223893004: [modules] Detect all indirect exports and represent them as such. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@modules-imports
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') | src/parsing/parser.cc » ('J')
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 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_;
};
« no previous file with comments | « no previous file | src/ast/modules.cc » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698