prettier-plugin-solidity
Version:
A Prettier Plugin for automatically formatting your Solidity code.
28 lines • 1.16 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 { StorageLocation } from './StorageLocation.js';
import { Identifier } from './Identifier.js';
export class TypedTupleMember {
constructor(ast, options) {
this.kind = NonterminalKind.TypedTupleMember;
let metadata = getNodeMetadata(ast);
this.typeName = new TypeName(ast.typeName, options);
if (ast.storageLocation) {
this.storageLocation = new StorageLocation(ast.storageLocation);
}
this.name = new Identifier(ast.name);
metadata = updateMetadata(metadata, [this.typeName, this.storageLocation]);
this.comments = metadata.comments;
this.loc = metadata.loc;
}
print(path, print) {
return joinExisting(' ', [
path.call(print, 'typeName'),
path.call(print, 'storageLocation'),
path.call(print, 'name')
]);
}
}
//# sourceMappingURL=TypedTupleMember.js.map