diff --git a/packages/babylon/src/comments.js b/packages/babylon/src/comments.js index dd6edafa48..56cdb5d0f4 100644 --- a/packages/babylon/src/comments.js +++ b/packages/babylon/src/comments.js @@ -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; }