mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow empty return expressions in functions with non-empty return parameters.
This commit is contained in:
@@ -979,9 +979,13 @@ bool TypeChecker::visit(ForStatement const& _forStatement)
|
||||
|
||||
void TypeChecker::endVisit(Return const& _return)
|
||||
{
|
||||
if (!_return.expression())
|
||||
return;
|
||||
ParameterList const* params = _return.annotation().functionReturnParameters;
|
||||
if (!_return.expression())
|
||||
{
|
||||
if (params && !params->parameters().empty())
|
||||
m_errorReporter.typeError(_return.location(), "Return arguments required.");
|
||||
return;
|
||||
}
|
||||
if (!params)
|
||||
{
|
||||
m_errorReporter.typeError(_return.location(), "Return arguments not allowed.");
|
||||
|
||||
Reference in New Issue
Block a user