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, |