prettier-plugin-solidity
Version:
A Prettier Plugin for automatically formatting your Solidity code.
32 lines • 1.19 kB
JavaScript
import { NonterminalKind } from '@nomicfoundation/slang/cst';
import { doc } from 'prettier';
import { SlangNode } from './SlangNode.js';
import { TerminalNode } from './TerminalNode.js';
import { InheritanceSpecifier } from './InheritanceSpecifier.js';
import { InterfaceMembers } from './InterfaceMembers.js';
const { group, line } = doc.builders;
export class InterfaceDefinition extends SlangNode {
constructor(ast, options) {
super(ast);
this.kind = NonterminalKind.InterfaceDefinition;
this.name = new TerminalNode(ast.name);
if (ast.inheritance) {
this.inheritance = new InheritanceSpecifier(ast.inheritance, options);
}
this.members = new InterfaceMembers(ast.members, options);
this.updateMetadata(this.inheritance, this.members);
}
print(path, print) {
return [
group([
'interface ',
path.call(print, 'name'),
this.inheritance ? [' ', path.call(print, 'inheritance')] : line,
'{'
]),
path.call(print, 'members'),
'}'
];
}
}
//# sourceMappingURL=InterfaceDefinition.js.map