Use addBlockOrNotComment in handleIfStatementComments (#18803)

This commit is contained in:
fisker Cheung authored and GitHub committed 2026-01-30 10:48:53 +08:00
1 parent 549e0cc51b
commit 3ff9bf78d8
1 file changed
+1 -6
+1 -6
View File
@@ -278,18 +278,13 @@ function handleIfStatementComments({
}
}
if (followingNode.type === "BlockStatement") {
addBlockStatementFirstComment(followingNode, comment);
return true;
}
// For comments positioned after the condition parenthesis in an if statement
// before the consequent without brackets on, such as
// if (a) /* comment */ true,
// we look at the next character to see if the following node
// is the consequent for the if statement
if (enclosingNode.consequent === followingNode) {
addLeadingComment(followingNode, comment);
addBlockOrNotComment(followingNode, comment);
return true;
}