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

Unified Diff: src/ast/modules.cc

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 | « src/ast/modules.h ('k') | src/ast/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/modules.cc
diff --git a/src/ast/modules.cc b/src/ast/modules.cc
index 3473ac6c042cc0fba42a3ca44b7cff30c0e9e24a..3a1f2e4b7b57a3c7a4d3055ee7d7e9ff2777a90e 100644
--- a/src/ast/modules.cc
+++ b/src/ast/modules.cc
@@ -9,7 +9,6 @@
namespace v8 {
namespace internal {
-
void ModuleDescriptor::AddImport(
const AstRawString* import_name, const AstRawString* local_name,
const AstRawString* module_request, Scanner::Location loc, Zone* zone) {
@@ -20,7 +19,9 @@ void ModuleDescriptor::AddImport(
entry->local_name = local_name;
entry->import_name = import_name;
entry->module_request = module_request;
- imports_.Add(entry, zone);
+ regular_imports_.insert(std::make_pair(entry->local_name, entry));
+ // We don't care if there's already an entry for this local name, as in that
+ // case we will report an error when declaring the variable.
}
@@ -32,7 +33,7 @@ void ModuleDescriptor::AddStarImport(
ModuleEntry* entry = new (zone) ModuleEntry(loc);
entry->local_name = local_name;
entry->module_request = module_request;
- imports_.Add(entry, zone);
+ special_imports_.Add(entry, zone);
}
@@ -41,7 +42,7 @@ void ModuleDescriptor::AddEmptyImport(
DCHECK_NOT_NULL(module_request);
ModuleEntry* entry = new (zone) ModuleEntry(loc);
entry->module_request = module_request;
- imports_.Add(entry, zone);
+ special_imports_.Add(entry, zone);
}
« no previous file with comments | « src/ast/modules.h ('k') | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698