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

Unified Diff: src/ast/modules.cc

Issue 2340903002: Revert of [modules] Make duplicate export error deterministic. (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 | « src/ast/modules.h ('k') | test/message/export-duplicate.js » ('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 827980afcce86c92a6575880d5d7676831582fc7..6d8f35f39048057944beb600d472ec64e296053f 100644
--- a/src/ast/modules.cc
+++ b/src/ast/modules.cc
@@ -136,30 +136,17 @@
const ModuleDescriptor::Entry* ModuleDescriptor::FindDuplicateExport(
Zone* zone) const {
- const ModuleDescriptor::Entry* candidate = nullptr;
ZoneSet<const AstRawString*> export_names(zone);
for (const auto& it : regular_exports_) {
const Entry* entry = it.second;
DCHECK_NOT_NULL(entry->export_name);
- DCHECK(entry->location.IsValid());
- bool is_duplicate = !export_names.insert(entry->export_name).second;
- if (is_duplicate &&
- (candidate == nullptr ||
- entry->location.beg_pos > candidate->location.beg_pos)) {
- candidate = entry;
- }
+ if (!export_names.insert(entry->export_name).second) return entry;
}
for (auto entry : special_exports_) {
if (entry->export_name == nullptr) continue; // Star export.
- DCHECK(entry->location.IsValid());
- bool is_duplicate = !export_names.insert(entry->export_name).second;
- if (is_duplicate &&
- (candidate == nullptr ||
- entry->location.beg_pos > candidate->location.beg_pos)) {
- candidate = entry;
- }
+ if (!export_names.insert(entry->export_name).second) return entry;
}
- return candidate;
+ return nullptr;
}
bool ModuleDescriptor::Validate(ModuleScope* module_scope,
« no previous file with comments | « src/ast/modules.h ('k') | test/message/export-duplicate.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698