aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorF. Eugene Aumson <feuGeneA@users.noreply.github.com>2018-09-25 01:18:10 +0800
committerF. Eugene Aumson <feuGeneA@users.noreply.github.com>2018-09-25 01:24:03 +0800
commit57fca16d7b1dc61c060c90fa440b1dc947aefb93 (patch)
treedd11634178b3f90b7848b11460b1926762191d9a
parenta9002558207883f66e3bb180415985d823f03772 (diff)
downloaddexon-sol-tools-57fca16d7b1dc61c060c90fa440b1dc947aefb93.tar
dexon-sol-tools-57fca16d7b1dc61c060c90fa440b1dc947aefb93.tar.gz
dexon-sol-tools-57fca16d7b1dc61c060c90fa440b1dc947aefb93.tar.bz2
dexon-sol-tools-57fca16d7b1dc61c060c90fa440b1dc947aefb93.tar.lz
dexon-sol-tools-57fca16d7b1dc61c060c90fa440b1dc947aefb93.tar.xz
dexon-sol-tools-57fca16d7b1dc61c060c90fa440b1dc947aefb93.tar.zst
dexon-sol-tools-57fca16d7b1dc61c060c90fa440b1dc947aefb93.zip
fix: use contract name for constructor method name
and for its return value
-rw-r--r--packages/sol-doc/src/solidity_doc_generator.ts16
1 files changed, 10 insertions, 6 deletions
diff --git a/packages/sol-doc/src/solidity_doc_generator.ts b/packages/sol-doc/src/solidity_doc_generator.ts
index 0df4a4af1..b0c9ff314 100644
--- a/packages/sol-doc/src/solidity_doc_generator.ts
+++ b/packages/sol-doc/src/solidity_doc_generator.ts
@@ -52,7 +52,7 @@ export async function generateSolDocAsync(
if (_.isUndefined(compiledContract.abi)) {
throw new Error('compiled contract did not contain ABI output');
}
- docWithDependencies[contractName] = _genDocSection(compiledContract);
+ docWithDependencies[contractName] = _genDocSection(compiledContract, contractName);
}
}
}
@@ -95,7 +95,7 @@ function _makeCompilerOptions(contractsDir: string, contractsToCompile?: string[
return compilerOptions;
}
-function _genDocSection(compiledContract: StandardContractOutput): DocSection {
+function _genDocSection(compiledContract: StandardContractOutput, contractName: string): DocSection {
const docSection: DocSection = {
comment: _.isUndefined(compiledContract.devdoc) ? '' : compiledContract.devdoc.title,
constructors: [],
@@ -109,7 +109,7 @@ function _genDocSection(compiledContract: StandardContractOutput): DocSection {
for (const abiDefinition of compiledContract.abi) {
switch (abiDefinition.type) {
case 'constructor':
- docSection.constructors.push(_genConstructorDoc(abiDefinition, compiledContract.devdoc));
+ docSection.constructors.push(_genConstructorDoc(contractName, abiDefinition, compiledContract.devdoc));
break;
case 'event':
(docSection.events as Event[]).push(_genEventDoc(abiDefinition));
@@ -130,17 +130,21 @@ function _genDocSection(compiledContract: StandardContractOutput): DocSection {
return docSection;
}
-function _genConstructorDoc(abiDefinition: ConstructorAbi, devdocIfExists: DevdocOutput | undefined): SolidityMethod {
+function _genConstructorDoc(
+ contractName: string,
+ abiDefinition: ConstructorAbi,
+ devdocIfExists: DevdocOutput | undefined,
+): SolidityMethod {
const { parameters, methodSignature } = _genMethodParamsDoc('', abiDefinition.inputs, devdocIfExists);
const comment = _devdocMethodDetailsIfExist(methodSignature, devdocIfExists);
const constructorDoc: SolidityMethod = {
isConstructor: true,
- name: '', // sad we have to specify this
+ name: contractName,
callPath: '',
parameters,
- returnType: { name: '', typeDocType: TypeDocTypes.Reference }, // sad we have to specify this
+ returnType: { name: contractName, typeDocType: TypeDocTypes.Reference }, // sad we have to specify this
isConstant: false,
isPayable: abiDefinition.payable,
comment,