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

Unified Diff: tools/gn/parse_tree.h

Issue 962003002: gn format: Have format sort sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 10 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
Index: tools/gn/parse_tree.h
diff --git a/tools/gn/parse_tree.h b/tools/gn/parse_tree.h
index dcf678babc2966307453742a3a9567b20c3b5a87..4dd0485c5b18f61ffa8ee151bee87c7c1e797603 100644
--- a/tools/gn/parse_tree.h
+++ b/tools/gn/parse_tree.h
@@ -32,23 +32,18 @@ class Comments {
virtual ~Comments();
const std::vector<Token>& before() const { return before_; }
- void append_before(Token c) {
- before_.push_back(c);
- }
+ void append_before(Token c) { before_.push_back(c); }
+ void clear_before() { before_.clear(); }
const std::vector<Token>& suffix() const { return suffix_; }
- void append_suffix(Token c) {
- suffix_.push_back(c);
- }
+ void append_suffix(Token c) { suffix_.push_back(c); }
// Reverse the order of the suffix comments. When walking the tree in
// post-order we append suffix comments in reverse order, so this fixes them
// up.
void ReverseSuffix();
const std::vector<Token>& after() const { return after_; }
- void append_after(Token c) {
- after_.push_back(c);
- }
+ void append_after(Token c) { after_.push_back(c); }
private:
// Whole line comments before the expression.
@@ -160,6 +155,8 @@ class AccessorNode : public ParseNode {
const IdentifierNode* member() const { return member_.get(); }
void set_member(scoped_ptr<IdentifierNode> i) { member_ = i.Pass(); }
+ void SetNewLocation(int line_number);
+
private:
Value ExecuteArrayAccess(Scope* scope, Err* err) const;
Value ExecuteScopeAccess(Scope* scope, Err* err) const;
@@ -348,6 +345,8 @@ class IdentifierNode : public ParseNode {
const Token& value() const { return value_; }
void set_value(const Token& t) { value_ = t; }
+ void SetNewLocation(int line_number);
+
private:
Token value_;
@@ -378,6 +377,8 @@ class ListNode : public ParseNode {
}
const std::vector<const ParseNode*>& contents() const { return contents_; }
+ void SortAsStringsList();
+
// 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.
@@ -418,6 +419,8 @@ class LiteralNode : public ParseNode {
const Token& value() const { return value_; }
void set_value(const Token& t) { value_ = t; }
+ void SetNewLocation(int line_number);
+
private:
Token value_;

Powered by Google App Engine
This is Rietveld 408576698