diff options
author | chriseth <chris@ethereum.org> | 2018-08-08 20:59:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-08 20:59:09 +0800 |
commit | de8e9114fdba97ffa9e649f044066aec45ff4812 (patch) | |
tree | d115ad4a75798152068330d263ebbdf58805b3cc /libsolidity | |
parent | fbc844317446adcc0c0e4772d5c20befdc9d2770 (diff) | |
parent | 99d3e8e45a7db18dedef5d1dde3cabd1e539efb2 (diff) | |
download | dexon-solidity-de8e9114fdba97ffa9e649f044066aec45ff4812.tar.gz dexon-solidity-de8e9114fdba97ffa9e649f044066aec45ff4812.tar.zst dexon-solidity-de8e9114fdba97ffa9e649f044066aec45ff4812.zip |
Merge pull request #4740 from ethereum/enforceNumberOfReturnValues
Disallow empty return in function with return arguments.
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index bd3187ae..6882a14f 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -982,9 +982,13 @@ bool TypeChecker::visit(ForStatement const& _forStatement) void TypeChecker::endVisit(Return const& _return) { + ParameterList const* params = _return.annotation().functionReturnParameters; if (!_return.expression()) + { + if (params && !params->parameters().empty()) + m_errorReporter.typeError(_return.location(), "Return arguments required."); return; - ParameterList const* params = _return.annotation().functionReturnParameters; + } if (!params) { m_errorReporter.typeError(_return.location(), "Return arguments not allowed."); |