prettier-plugin-solidity
Version:
A Prettier Plugin for automatically formatting your Solidity code.
25 lines • 1.08 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 { YulVariableDeclarationValue } from './YulVariableDeclarationValue.js';
import { YulVariableNames } from './YulVariableNames.js';
export class YulVariableDeclarationStatement {
constructor(ast, options) {
this.kind = NonterminalKind.YulVariableDeclarationStatement;
let metadata = getNodeMetadata(ast);
this.variables = new YulVariableNames(ast.variables);
if (ast.value) {
this.value = new YulVariableDeclarationValue(ast.value, options);
}
metadata = updateMetadata(metadata, [this.value]);
this.comments = metadata.comments;
this.loc = metadata.loc;
}
print(path, print) {
return joinExisting(' ', [
['let', path.call(print, 'variables')],
path.call(print, 'value')
]);
}
}
//# sourceMappingURL=YulVariableDeclarationStatement.js.map