Index: tools/gn/loader.cc |
diff --git a/tools/gn/loader.cc b/tools/gn/loader.cc |
index 3ac868cfcd79590bdf4a084682f565d1875bdf80..3ca25ca6201c6fdda329de572c296fe61bb9ee4f 100644 |
--- a/tools/gn/loader.cc |
+++ b/tools/gn/loader.cc |
@@ -211,7 +211,7 @@ void LoaderImpl::ScheduleLoadFile(const Settings* settings, |
pending_loads_++; |
if (!AsyncLoadFile(origin, settings->build_settings(), file, |
base::Bind(&LoaderImpl::BackgroundLoadFile, this, |
- settings, file), |
+ settings, file, origin), |
&err)) { |
g_scheduler->FailWithError(err); |
DecrementPendingLoads(); |
@@ -235,6 +235,7 @@ void LoaderImpl::ScheduleLoadBuildConfig( |
void LoaderImpl::BackgroundLoadFile(const Settings* settings, |
const SourceFile& file_name, |
+ const LocationRange& origin, |
const ParseNode* root) { |
if (!root) { |
main_loop_->PostTask(FROM_HERE, |
@@ -260,11 +261,14 @@ void LoaderImpl::BackgroundLoadFile(const Settings* settings, |
Err err; |
root->Execute(&our_scope, &err); |
- if (err.has_error()) |
- g_scheduler->FailWithError(err); |
+ if (!err.has_error()) |
+ our_scope.CheckForUnusedVars(&err); |
- if (!our_scope.CheckForUnusedVars(&err)) |
+ if (err.has_error()) { |
brettw
2016/04/20 20:53:19
We should check that the origin range isn't empty
agrieve
2016/04/21 00:59:35
Done.
|
+ err.AppendSubErr(Err(origin, "which caused the package to be included.")); |
brettw
2016/04/20 20:53:19
Can you replace "package" with "file"? I've not ca
agrieve
2016/04/21 00:59:35
Done.
|
g_scheduler->FailWithError(err); |
+ } |
+ |
// Pass all of the items that were defined off to the builder. |
for (auto& item : collected_items) { |