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

Unified Diff: tools/gn/parse_tree.h

Issue 748863003: gn format: penalty-based scheme for line breaking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-more-disabled
Patch Set: x64 Created 6 years, 1 month 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/format_test_data/052.gn ('k') | tools/gn/parse_tree.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/parse_tree.h
diff --git a/tools/gn/parse_tree.h b/tools/gn/parse_tree.h
index 60d15700c0189af8d63c97b0253e96308a59a003..dcf678babc2966307453742a3a9567b20c3b5a87 100644
--- a/tools/gn/parse_tree.h
+++ b/tools/gn/parse_tree.h
@@ -378,11 +378,20 @@ class ListNode : public ParseNode {
}
const std::vector<const ParseNode*>& contents() const { return contents_; }
+ // During formatting, do we want this list to always be multliline? This is
+ // used to make assignments to deps, sources, etc. always be multiline lists,
+ // rather than collapsed to a single line when they're one element.
+ bool prefer_multiline() const { return prefer_multiline_; }
+ void set_prefer_multiline(bool prefer_multiline) {
+ prefer_multiline_ = prefer_multiline;
+ }
+
private:
// Tokens corresponding to the [ and ]. The end token is stored in inside an
// custom parse node so that it can have comments hung off of it.
Token begin_token_;
scoped_ptr<EndNode> end_;
+ bool prefer_multiline_;
// Owning pointers, use unique_ptr when we can use C++11.
std::vector<const ParseNode*> contents_;
« no previous file with comments | « tools/gn/format_test_data/052.gn ('k') | tools/gn/parse_tree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698