| Index: tools/gn/parser.cc
|
| diff --git a/tools/gn/parser.cc b/tools/gn/parser.cc
|
| index 1eb646394b922aea13c7de1f9fac39ae4ca47a32..debb51201490be9043e4b11f24a3ec0a827f2d09 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 (j < static_cast<int>(line_comment_tokens_.size())) {
|
| if (start.byte() >= line_comment_tokens_[j].location().byte()) {
|
| - const_cast<ParseNode*>((*i))->comments_mutable()->append_before(
|
| + const_cast<ParseNode*>(*i)->comments_mutable()->append_before(
|
| line_comment_tokens_[j]);
|
| ++j;
|
| } else {
|
| @@ -588,12 +588,16 @@ void Parser::AssignComments(ParseNode* file) {
|
|
|
| while (j >= 0) {
|
| if (end.byte() <= suffix_comment_tokens_[j].location().byte()) {
|
| - const_cast<ParseNode*>((*i))->comments_mutable()->append_suffix(
|
| + const_cast<ParseNode*>(*i)->comments_mutable()->append_suffix(
|
| suffix_comment_tokens_[j]);
|
| --j;
|
| } 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();
|
| }
|
| }
|
|
|