UNPKG

prettier-plugin-solidity

Version:

A Prettier Plugin for automatically formatting your Solidity code.

25 lines 895 B
import { NonterminalKind } from '@nomicfoundation/slang/cst'; import { getNodeMetadata, updateMetadata } from '../slang-utils/metadata.js'; import { Identifier } from './Identifier.js'; import { StructMembers } from './StructMembers.js'; export class StructDefinition { constructor(ast, options) { this.kind = NonterminalKind.StructDefinition; let metadata = getNodeMetadata(ast); this.name = new Identifier(ast.name); this.members = new StructMembers(ast.members, options); metadata = updateMetadata(metadata, [this.members]); this.comments = metadata.comments; this.loc = metadata.loc; } print(path, print) { return [ 'struct ', path.call(print, 'name'), ' {', path.call(print, 'members'), '}' ]; } } //# sourceMappingURL=StructDefinition.js.map