UNPKG

prettier-plugin-solidity

Version:

A Prettier Plugin for automatically formatting your Solidity code.

21 lines 852 B
import { NonterminalKind } from '@nomicfoundation/slang/cst'; import { getNodeMetadata, updateMetadata } from '../slang-utils/metadata.js'; import { TypeName } from './TypeName.js'; import { Expression } from './Expression.js'; export class ArrayTypeName { constructor(ast, options) { this.kind = NonterminalKind.ArrayTypeName; let metadata = getNodeMetadata(ast); this.operand = new TypeName(ast.operand, options); if (ast.index) { this.index = new Expression(ast.index, options); } metadata = updateMetadata(metadata, [this.operand, this.index]); this.comments = metadata.comments; this.loc = metadata.loc; } print(path, print) { return [path.call(print, 'operand'), '[', path.call(print, 'index'), ']']; } } //# sourceMappingURL=ArrayTypeName.js.map