UNPKG

prettier-plugin-solidity

Version:

A Prettier Plugin for automatically formatting your Solidity code.

21 lines 991 B
import { NonterminalKind } from '@nomicfoundation/slang/cst'; import { util } from 'prettier'; import addCollectionNodeFirstComment from './add-collection-node-first-comment.js'; const { addLeadingComment } = util; export default function handleElseBranchComments({ enclosingNode, followingNode, comment }) { if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.kind) !== NonterminalKind.ElseBranch || !followingNode) { return false; } if (followingNode === enclosingNode.body && followingNode.variant.kind === NonterminalKind.IfStatement) { if (followingNode.variant.body.variant.kind === NonterminalKind.Block) { addCollectionNodeFirstComment(followingNode.variant.body.variant.statements, comment); } else { addLeadingComment(followingNode.variant.body.variant, comment); } return true; } return false; } //# sourceMappingURL=handle-else-branch-comments.js.map