aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorDaniel Kirchner <daniel@ekpyron.org>2018-08-08 02:47:23 +0800
committerDaniel Kirchner <daniel@ekpyron.org>2018-08-08 02:48:07 +0800
commitcc83e69469ed3968d840effb340e925aceeb64fa (patch)
treef510fa5354539ae1313d06511cecdcb2bddf54e7 /libsolidity
parentd7756322c07634fa2ca0649a33585fc167079786 (diff)
downloaddexon-solidity-cc83e69469ed3968d840effb340e925aceeb64fa.tar.gz
dexon-solidity-cc83e69469ed3968d840effb340e925aceeb64fa.tar.zst
dexon-solidity-cc83e69469ed3968d840effb340e925aceeb64fa.zip
Disallow empty return expressions in functions with non-empty return parameters.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 38331a43..0e87053e 100644
--- a/libsolidity/analysis/TypeChecker.cpp
+++ b/libsolidity/analysis/TypeChecker.cpp
@@ -979,9 +979,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.");