Ensure constant getters show in docs (#4649)
This commit is contained in:
17
docs/templates/properties.js
vendored
17
docs/templates/properties.js
vendored
@ -1,4 +1,4 @@
|
||||
const { isNodeType } = require('solidity-ast/utils');
|
||||
const { isNodeType, findAll } = require('solidity-ast/utils');
|
||||
const { slug } = require('./helpers');
|
||||
|
||||
module.exports.anchor = function anchor({ item, contract }) {
|
||||
@ -39,6 +39,21 @@ module.exports['has-errors'] = function ({ item }) {
|
||||
return item.inheritance.some(c => c.errors.length > 0);
|
||||
};
|
||||
|
||||
module.exports.functions = function ({ item }) {
|
||||
return [
|
||||
...[...findAll('FunctionDefinition', item)].filter(f => f.visibility !== 'private'),
|
||||
...[...findAll('VariableDeclaration', item)].filter(f => f.visibility === 'public'),
|
||||
];
|
||||
};
|
||||
|
||||
module.exports.returns2 = function ({ item }) {
|
||||
if (isNodeType('VariableDeclaration', item)) {
|
||||
return [{ type: item.typeDescriptions.typeString }];
|
||||
} else {
|
||||
return item.returns;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports['inherited-functions'] = function ({ item }) {
|
||||
const { inheritance } = item;
|
||||
const baseFunctions = new Set(inheritance.flatMap(c => c.functions.flatMap(f => f.baseFunctions ?? [])));
|
||||
|
||||
Reference in New Issue
Block a user