Skip to content

Commit

Permalink
Removed unneeded newlines from parsed comments
Browse files Browse the repository at this point in the history
Newlines from comments separated by lines are retained when comments
are appended, so adding a newline between separate comments for a
node is not needed.
  • Loading branch information
cquammen committed Oct 9, 2014
1 parent 4d23492 commit fd06bfc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions src/lib_json/json_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,6 @@ Reader::addComment(Location begin, Location end, CommentPlacement placement) {
assert(lastValue_ != 0);
lastValue_->setComment(std::string(begin, end), placement);
} else {
if (!commentsBefore_.empty())
commentsBefore_ += "\n";
commentsBefore_ += std::string(begin, end);
}
}
Expand Down
3 changes: 2 additions & 1 deletion test/data/test_comment_02.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
},
// C++-style comment
"cpp-test" : {
// Internal comment cpp-style
// Multiline comment cpp-style
// Second line
"c" : 3,
"d" : 4
}
Expand Down

0 comments on commit fd06bfc

Please sign in to comment.