Error for return with no values when result parameters are not named.
From-SVN: r171576
This commit is contained in:
parent
7e3b6543e0
commit
4e90195a62
@ -2581,10 +2581,20 @@ Return_statement::do_determine_types()
|
|||||||
void
|
void
|
||||||
Return_statement::do_check_types(Gogo*)
|
Return_statement::do_check_types(Gogo*)
|
||||||
{
|
{
|
||||||
if (this->vals_ == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
const Typed_identifier_list* results = this->results_;
|
const Typed_identifier_list* results = this->results_;
|
||||||
|
if (this->vals_ == NULL)
|
||||||
|
{
|
||||||
|
if (results != NULL
|
||||||
|
&& !results->empty()
|
||||||
|
&& results->front().name().empty())
|
||||||
|
{
|
||||||
|
// The result parameters are not named, which means that we
|
||||||
|
// need to supply values for them.
|
||||||
|
this->report_error(_("not enough arguments to return"));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (results == NULL)
|
if (results == NULL)
|
||||||
{
|
{
|
||||||
this->report_error(_("return with value in function "
|
this->report_error(_("return with value in function "
|
||||||
@ -2621,7 +2631,7 @@ Return_statement::do_check_types(Gogo*)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pt != results->end())
|
if (pt != results->end())
|
||||||
this->report_error(_("not enough values in return statement"));
|
this->report_error(_("not enough arguments to return"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build a RETURN_EXPR tree.
|
// Build a RETURN_EXPR tree.
|
||||||
|
Loading…
Reference in New Issue
Block a user