prettier-plugin-solidity
Version:
A Prettier Plugin for automatically formatting your Solidity code.
27 lines • 1.1 kB
JavaScript
import { NonterminalKind } from '@nomicfoundation/slang/cst';
import { extractVariant } from '../slang-utils/extract-variant.js';
import { SlangNode } from './SlangNode.js';
import { IdentifierPath } from './IdentifierPath.js';
import { ArgumentsDeclaration } from './ArgumentsDeclaration.js';
export class ModifierInvocation extends SlangNode {
constructor(ast, options) {
super(ast);
this.kind = NonterminalKind.ModifierInvocation;
this.name = new IdentifierPath(ast.name);
if (ast.arguments) {
this.arguments = extractVariant(new ArgumentsDeclaration(ast.arguments, options));
}
this.updateMetadata(this.name, this.arguments);
}
cleanModifierInvocationArguments() {
if (this.arguments &&
this.arguments.kind === NonterminalKind.PositionalArgumentsDeclaration &&
this.arguments.isEmpty) {
delete this.arguments;
}
}
print(path, print) {
return [path.call(print, 'name'), path.call(print, 'arguments')];
}
}
//# sourceMappingURL=ModifierInvocation.js.map