(path, options, print)
| 46 | } |
| 47 | |
| 48 | function printExpressionStatement(path, options, print) { |
| 49 | /** @type {Doc[]} */ |
| 50 | const parts = [print("expression")]; |
| 51 | |
| 52 | if (shouldExpressionStatementPrintLeadingSemicolon(path, options)) { |
| 53 | if (shouldExpressionStatementPrintOwnComments(path, options)) { |
| 54 | const { node } = path; |
| 55 | const typeCastComment = getComments(node, CommentCheckFlags.Leading).at( |
| 56 | -1, |
| 57 | ); |
| 58 | |
| 59 | // Print the type cast comment separately and print `;` before it |
| 60 | const typeCastCommentDoc = printLeadingComments(path, options, { |
| 61 | filter: (comment) => comment === typeCastComment, |
| 62 | }); |
| 63 | |
| 64 | return printComments(path, [";", typeCastCommentDoc, ...parts], options, { |
| 65 | filter: (comment) => comment !== typeCastComment, |
| 66 | }); |
| 67 | } |
| 68 | |
| 69 | parts.unshift(";"); |
| 70 | } else if (shouldPrintSemicolon(path, options)) { |
| 71 | parts.push(";"); |
| 72 | } |
| 73 | |
| 74 | return parts; |
| 75 | } |
| 76 | |
| 77 | export { printExpressionStatement }; |
no test coverage detected
searching dependent graphs…