UNPKG

prettier-plugin-solidity

Version:

A Prettier Plugin for automatically formatting your Solidity code.

23 lines 1.15 kB
import { NonterminalKind } from '@nomicfoundation/slang/cst'; import { isBlockComment } from '../slang-utils/is-comment.js'; import { SlangNode } from './SlangNode.js'; import { PositionalArguments } from './PositionalArguments.js'; export class PositionalArgumentsDeclaration extends SlangNode { constructor(ast, options) { super(ast); this.kind = NonterminalKind.PositionalArgumentsDeclaration; this.arguments = new PositionalArguments(ast.arguments, options); this.updateMetadata(this.arguments); // We need to check the comments at this point because they will be removed // from this node into the root node. // Since we are collecting comments in a different array, we have to query // the ast directly for possible block comments. this.isEmpty = this.arguments.items.length === 0 && // no arguments !ast.cst.children().some(({ node }) => isBlockComment(node)); // no block comments } print(path, print) { return ['(', path.call(print, 'arguments'), ')']; } } //# sourceMappingURL=PositionalArgumentsDeclaration.js.map