From b42e865c61f324ee8a6ef080b337420aa8c98e92 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sat, 4 Feb 2017 18:53:13 -0800 Subject: [PATCH] Print dangling on ast on all the paths --- src/comments.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/comments.js b/src/comments.js index b1894373..2a938d3b 100644 --- a/src/comments.js +++ b/src/comments.js @@ -168,8 +168,8 @@ function attach(comments, ast, text) { } else if (enclosingNode) { addDanglingComment(enclosingNode, comment); } else { - // TODO: If there are no nodes at all, we should still somehow - // print the comment. + // There are no nodes, let's attach it to the root of the ast + addDanglingComment(ast, comment); } } else { // Otherwise, text exists both before and after the comment on @@ -193,8 +193,8 @@ function attach(comments, ast, text) { } else if (enclosingNode) { addDanglingComment(enclosingNode, comment); } else { - // TODO: If there are no nodes at all, we should still somehow - // print the comment. + // There are no nodes, let's attach it to the root of the ast + addDanglingComment(ast, comment); } } });