Index: src/ast/modules.cc |
diff --git a/src/ast/modules.cc b/src/ast/modules.cc |
index 2d28d5564b546b01ea1b2ab5bd3eb56b6572b379..1c8ddf44fef35b2569f8cdb1524e9c4c0f766f3f 100644 |
--- a/src/ast/modules.cc |
+++ b/src/ast/modules.cc |
@@ -88,7 +88,8 @@ Handle<ModuleInfoEntry> ModuleDescriptor::Entry::Serialize( |
isolate, ToStringOrUndefined(isolate, export_name), |
ToStringOrUndefined(isolate, local_name), |
ToStringOrUndefined(isolate, import_name), |
- Handle<Object>(Smi::FromInt(module_request), isolate)); |
+ Handle<Object>(Smi::FromInt(module_request), isolate), location.beg_pos, |
+ location.end_pos); |
} |
ModuleDescriptor::Entry* ModuleDescriptor::Entry::Deserialize( |
@@ -184,6 +185,13 @@ void ModuleDescriptor::MakeIndirectExportsExplicit(Zone* zone) { |
static_cast<int>(module_requests_.size())); |
entry->import_name = import->second->import_name; |
entry->module_request = import->second->module_request; |
+ // Hack: When the indirect export cannot be resolved, we want the error |
+ // message to point at the import statement, not at the export statement. |
+ // Therefore we overwrite [entry]'s location here. Note that Validate() |
+ // has already checked for duplicate exports, so it's guaranteed that we |
+ // won't need to report any error pointing at the (now lost) export |
+ // location. |
+ entry->location = import->second->location; |
entry->local_name = nullptr; |
AddSpecialExport(entry, zone); |
it = regular_exports_.erase(it); |