add and test support for fallback functions

This commit is contained in:
F. Eugene Aumson 2018-09-17 17:23:55 -04:00
parent 3c7155afb0
commit 5b07669bd0
No known key found for this signature in database
GPG Key ID: 1AC187F051040675
2 changed files with 8 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import * as _ from 'lodash'; import * as _ from 'lodash';
import { import {
AbiDefinition,
ConstructorAbi, ConstructorAbi,
DataItem, DataItem,
DevdocOutput, DevdocOutput,
@ -100,10 +101,13 @@ function _genDocSection(compiledContract: StandardContractOutput): DocSection {
// that's because the type of the events array doesn't have any fields for documentation! // that's because the type of the events array doesn't have any fields for documentation!
break; break;
case 'function': case 'function':
case 'fallback':
docSection.methods.push(_genMethodDoc(abiDefinition, compiledContract.devdoc)); docSection.methods.push(_genMethodDoc(abiDefinition, compiledContract.devdoc));
break; break;
default: default:
throw new Error(`unknown and unsupported AbiDefinition type '${abiDefinition.type}'`); throw new Error(
`unknown and unsupported AbiDefinition type '${(abiDefinition as AbiDefinition).type}'`,
);
} }
} }

View File

@ -16,6 +16,9 @@ contract NatspecEverything {
/// @return publicMethod @return /// @return publicMethod @return
function publicMethod(int p) public pure returns(int r) { return p; } function publicMethod(int p) public pure returns(int r) { return p; }
/// @dev Fallback @dev
function () public {}
/// @notice externalMethod @notice /// @notice externalMethod @notice
/// @dev externalMethod @dev /// @dev externalMethod @dev
/// @param p externalMethod @param /// @param p externalMethod @param