diff options
author | Christian <c@ethdev.com> | 2014-12-15 23:09:50 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-12-15 23:09:50 +0800 |
commit | c40725c22adaa2159bd06894740f7559733afbb4 (patch) | |
tree | 979ec3f5ba0d4540097e56fd08f809880f35b7de /AST.cpp | |
parent | 40f7c32e57cf8b09d45f52935b8726f5baef5358 (diff) | |
download | dexon-solidity-c40725c22adaa2159bd06894740f7559733afbb4.tar.gz dexon-solidity-c40725c22adaa2159bd06894740f7559733afbb4.tar.zst dexon-solidity-c40725c22adaa2159bd06894740f7559733afbb4.zip |
Check that constructor does not have "returns" directive.
Diffstat (limited to 'AST.cpp')
-rw-r--r-- | AST.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -39,6 +39,17 @@ TypeError ASTNode::createTypeError(string const& _description) const return TypeError() << errinfo_sourceLocation(getLocation()) << errinfo_comment(_description); } +void ContractDefinition::checkTypeRequirements() +{ + FunctionDefinition const* constructor = getConstructor(); + if (constructor && !constructor->getReturnParameters().empty()) + BOOST_THROW_EXCEPTION(constructor->getReturnParameterList()->createTypeError( + "Non-empty \"returns\" directive for constructor.")); + + for (ASTPointer<FunctionDefinition> const& function: getDefinedFunctions()) + function->checkTypeRequirements(); +} + vector<FunctionDefinition const*> ContractDefinition::getInterfaceFunctions() const { vector<FunctionDefinition const*> exportedFunctions; |