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

Unified Diff: tools/gn/parser.cc

Issue 595753002: gn: handle continued suffix comments (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-append-comment
Patch Set: only continue if at same column Created 6 years, 3 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/parse_tree.cc ('k') | tools/gn/parser_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/parser.cc
diff --git a/tools/gn/parser.cc b/tools/gn/parser.cc
index c99282f2b0fb36ade03ffb5c439634a7e8f75ef5..b1b310f73ebe82279b532e24457c268be272b7b1 100644
--- a/tools/gn/parser.cc
+++ b/tools/gn/parser.cc
@@ -550,7 +550,7 @@ void Parser::AssignComments(ParseNode* file) {
const Location& start = (*i)->GetRange().begin();
while (cur_comment < static_cast<int>(line_comment_tokens_.size())) {
if (start.byte() >= line_comment_tokens_[cur_comment].location().byte()) {
- const_cast<ParseNode*>((*i))->comments_mutable()->append_before(
+ const_cast<ParseNode*>(*i)->comments_mutable()->append_before(
line_comment_tokens_[cur_comment]);
++cur_comment;
} else {
@@ -589,12 +589,16 @@ void Parser::AssignComments(ParseNode* file) {
while (cur_comment >= 0) {
if (end.byte() <= suffix_comment_tokens_[cur_comment].location().byte()) {
- const_cast<ParseNode*>((*i))->comments_mutable()->append_suffix(
+ const_cast<ParseNode*>(*i)->comments_mutable()->append_suffix(
suffix_comment_tokens_[cur_comment]);
--cur_comment;
} else {
break;
}
}
+
+ // Suffix comments were assigned in reverse, so if there were multiple on
+ // the same node, they need to be reversed.
+ const_cast<ParseNode*>(*i)->comments_mutable()->ReverseSuffix();
}
}
« no previous file with comments | « tools/gn/parse_tree.cc ('k') | tools/gn/parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698