diff --git a/packages/babylon/src/parser/comments.js b/packages/babylon/src/parser/comments.js index 9c5d58070f..3b8345fa65 100644 --- a/packages/babylon/src/parser/comments.js +++ b/packages/babylon/src/parser/comments.js @@ -74,7 +74,7 @@ pp.processComment = function (node) { if (lastChild) { if (lastChild.leadingComments) { - if (last(lastChild.leadingComments).end < node.start) { + if (lastChild !== node && last(lastChild.leadingComments).end <= node.start) { node.leadingComments = lastChild.leadingComments; lastChild.leadingComments = null; } else {