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

Unified Diff: tools/gn/loader.cc

Issue 1905473003: 🐣 GN: Print the import trail when parse errors occur. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move is_null() to header Created 4 years, 8 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 | « tools/gn/loader.h ('k') | tools/gn/location.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/loader.cc
diff --git a/tools/gn/loader.cc b/tools/gn/loader.cc
index 3ac868cfcd79590bdf4a084682f565d1875bdf80..e3165b9c6f72ae77daea4085531fb1dd7275a23a 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,15 @@ 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()) {
+ if (!origin.is_null())
+ err.AppendSubErr(Err(origin, "which caused the file to be included."));
g_scheduler->FailWithError(err);
+ }
+
// Pass all of the items that were defined off to the builder.
for (auto& item : collected_items) {
« no previous file with comments | « tools/gn/loader.h ('k') | tools/gn/location.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698