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

Unified Diff: tools/gn/value.cc

Issue 280273004: Support printing scopes in GN (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « no previous file | tools/gn/value_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/value.cc
diff --git a/tools/gn/value.cc b/tools/gn/value.cc
index 3632ddf4a80c5b1cfaab255c00b2467ca92d2cd5..b85eb2d83023c3dc07ef1e7d34bb17d544e57777 100644
--- a/tools/gn/value.cc
+++ b/tools/gn/value.cc
@@ -153,8 +153,22 @@ std::string Value::ToString(bool quote_string) const {
result.push_back(']');
return result;
}
- case SCOPE:
- return std::string("<scope>");
+ case SCOPE: {
+ Scope::KeyValueMap scope_values;
+ scope_value_->GetCurrentScopeValues(&scope_values);
+ if (scope_values.empty())
+ return std::string("{ }");
+
+ std::string result = "{\n";
+ for (Scope::KeyValueMap::const_iterator i = scope_values.begin();
+ i != scope_values.end(); ++i) {
+ result += " " + i->first.as_string() + " = " +
+ i->second.ToString(true) + "\n";
+ }
+ result += "}";
+
+ return result;
+ }
}
return std::string();
}
« no previous file with comments | « no previous file | tools/gn/value_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698