prettier-plugin-solidity
Version:
A Prettier Plugin for automatically formatting your Solidity code.
28 lines • 1.1 kB
JavaScript
import { NonterminalKind } from '@nomicfoundation/slang/cst';
import { getNodeMetadata, updateMetadata } from '../slang-utils/metadata.js';
import { joinExisting } from '../slang-utils/join-existing.js';
import { TypeName } from './TypeName.js';
import { Identifier } from './Identifier.js';
export class EventParameter {
constructor(ast, options) {
var _a;
this.kind = NonterminalKind.EventParameter;
let metadata = getNodeMetadata(ast);
this.typeName = new TypeName(ast.typeName, options);
this.indexedKeyword = (_a = ast.indexedKeyword) === null || _a === void 0 ? void 0 : _a.unparse();
if (ast.name) {
this.name = new Identifier(ast.name);
}
metadata = updateMetadata(metadata, [this.typeName]);
this.comments = metadata.comments;
this.loc = metadata.loc;
}
print(path, print) {
return joinExisting(' ', [
path.call(print, 'typeName'),
this.indexedKeyword,
path.call(print, 'name')
]);
}
}
//# sourceMappingURL=EventParameter.js.map