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

Unified Diff: src/ast/modules.cc

Issue 2451153002: [modules] Improve error messages. (Closed)
Patch Set: Address comments. Created 4 years, 2 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') | src/ast/scopeinfo.cc » ('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 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);
« no previous file with comments | « src/ast/modules.h ('k') | src/ast/scopeinfo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698