Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 55x 55x 55x 85x 20x 65x 85x 55x 85x 20x 15x 55x 85x 80x 70x 55x 85x 55x | const { doc: { builders: { group, hardline, indent, line } } } = require('prettier'); const printSeparatedList = require('./print-separated-list'); const modifierParameters = (node, path, print) => { if (node.parameters && node.parameters.length > 0) { return [ '(', printSeparatedList(path.map(print, 'parameters'), { separator: [ ',', // To keep consistency any list of parameters will split if it's longer than 2. // For more information see: // https://github.com/prettier-solidity/prettier-plugin-solidity/issues/256 node.parameters.length > 2 ? hardline : line ] }), ')' ]; } return '()'; }; const virtual = (node) => (node.isVirtual ? [line, 'virtual'] : ''); const override = (node, path, print) => { if (!node.override) return ''; if (node.override.length === 0) return [line, 'override']; return [ line, 'override(', printSeparatedList(path.map(print, 'override')), ')' ]; }; const body = (node, path, print) => { if (!node.body) return ';'; if (node.isVirtual) return group([' ', path.call(print, 'body')]); return [' ', path.call(print, 'body')]; }; const ModifierDefinition = { print: ({ node, path, print }) => [ 'modifier ', node.name, modifierParameters(node, path, print), group(indent([virtual(node), override(node, path, print)])), body(node, path, print) ] }; module.exports = ModifierDefinition; |