check whether the last child is the same node as the one we're removing comments from - fixes #2072, fixes #2068

This commit is contained in:
Sebastian McKenzie 2015-07-25 02:16:31 +01:00
parent e15a28cc1c
commit 2ed9416e19

View File

@ -73,7 +73,7 @@ pp.processComment = function (node) {
}
if (lastChild) {
if (lastChild.leadingComments && last(lastChild.leadingComments).end <= node.start) {
if (lastChild !== node && lastChild.leadingComments && last(lastChild.leadingComments).end <= node.start) {
node.leadingComments = lastChild.leadingComments;
lastChild.leadingComments = null;
}