Index: src/ast/modules.cc |
diff --git a/src/ast/modules.cc b/src/ast/modules.cc |
index 2d28d5564b546b01ea1b2ab5bd3eb56b6572b379..6b527de1f568b8c408cdd11d5d6a0abf1fc75aeb 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,14 @@ 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.beg_pos = import->second->location.beg_pos; |
adamk
2016/10/26 12:38:16
Why can't you just assign the location directly?
|
+ entry->location.end_pos = import->second->location.end_pos; |
entry->local_name = nullptr; |
AddSpecialExport(entry, zone); |
it = regular_exports_.erase(it); |