mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4740 from ethereum/enforceNumberOfReturnValues
Disallow empty return in function with return arguments.
This commit is contained in:
@@ -982,9 +982,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