UNPKG

prettier-plugin-solidity

Version:

A Prettier Plugin for automatically formatting your Solidity code.

20 lines 826 B
import { NonterminalKind } from '@nomicfoundation/slang/cst'; import { getNodeMetadata, updateMetadata } from '../slang-utils/metadata.js'; import { YulPath } from './YulPath.js'; export class YulPaths { constructor(ast) { this.kind = NonterminalKind.YulPaths; let metadata = getNodeMetadata(ast, true); this.items = ast.items.map((item) => new YulPath(item)); this.separators = ast.separators.map((separator) => separator.unparse()); metadata = updateMetadata(metadata, [this.items]); this.comments = metadata.comments; this.loc = metadata.loc; } print(path, print) { return path .map(print, 'items') .map((item, index) => index === 0 ? item : [this.separators[index - 1], item]); } } //# sourceMappingURL=YulPaths.js.map