| Index: src/modules.cc
|
| diff --git a/src/modules.cc b/src/modules.cc
|
| index 267c398c472c74ac035c7880fa04d9773762a5dd..be45c423a53024a6a325d88496542f7c3d3f2314 100644
|
| --- a/src/modules.cc
|
| +++ b/src/modules.cc
|
| @@ -15,6 +15,7 @@ namespace internal {
|
| void ModuleDescriptor::AddLocalExport(const AstRawString* export_name,
|
| const AstRawString* local_name,
|
| Zone* zone, bool* ok) {
|
| + DCHECK(!IsFrozen());
|
| void* key = const_cast<AstRawString*>(export_name);
|
|
|
| ZoneAllocationPolicy allocator(zone);
|
| @@ -25,9 +26,12 @@ void ModuleDescriptor::AddLocalExport(const AstRawString* export_name,
|
| }
|
|
|
| ZoneHashMap::Entry* p =
|
| - exports_->Lookup(key, export_name->hash(), !IsFrozen(), allocator);
|
| - if (p == nullptr || p->value != nullptr) {
|
| + exports_->LookupOrInsert(key, export_name->hash(), allocator);
|
| + DCHECK_NOT_NULL(p);
|
| + if (p->value != nullptr) {
|
| + // Duplicate export.
|
| *ok = false;
|
| + return;
|
| }
|
|
|
| p->value = const_cast<AstRawString*>(local_name);
|
| @@ -37,10 +41,8 @@ void ModuleDescriptor::AddLocalExport(const AstRawString* export_name,
|
| const AstRawString* ModuleDescriptor::LookupLocalExport(
|
| const AstRawString* export_name, Zone* zone) {
|
| if (exports_ == nullptr) return nullptr;
|
| - ZoneAllocationPolicy allocator(zone);
|
| - ZoneHashMap::Entry* entry =
|
| - exports_->Lookup(const_cast<AstRawString*>(export_name),
|
| - export_name->hash(), false, allocator);
|
| + ZoneHashMap::Entry* entry = exports_->Lookup(
|
| + const_cast<AstRawString*>(export_name), export_name->hash());
|
| if (entry == nullptr) return nullptr;
|
| DCHECK_NOT_NULL(entry->value);
|
| return static_cast<const AstRawString*>(entry->value);
|
|
|