Fix select setting a map expression.
Also fix select parsing when declaring a variable with no statements. From-SVN: r171690
This commit is contained in:
parent
5b9e705e63
commit
df740f400a
1 changed files with 28 additions and 26 deletions
|
@ -4274,20 +4274,21 @@ Parse::comm_clause(Select_clauses* clauses, bool* saw_default)
|
|||
bool got_case = this->comm_case(&is_send, &channel, &val, &closed,
|
||||
&varname, &closedname, &is_default);
|
||||
|
||||
if (!is_send
|
||||
&& varname.empty()
|
||||
&& closedname.empty()
|
||||
&& val != NULL
|
||||
&& val->index_expression() != NULL)
|
||||
val->index_expression()->set_is_lvalue();
|
||||
|
||||
if (this->peek_token()->is_op(OPERATOR_COLON))
|
||||
this->advance_token();
|
||||
else
|
||||
error_at(this->location(), "expected colon");
|
||||
|
||||
Block* statements = NULL;
|
||||
Named_object* var = NULL;
|
||||
Named_object* closedvar = NULL;
|
||||
if (this->peek_token()->is_op(OPERATOR_SEMICOLON))
|
||||
this->advance_token();
|
||||
else if (this->statement_list_may_start_here())
|
||||
{
|
||||
this->gogo_->start_block(this->location());
|
||||
|
||||
Named_object* var = NULL;
|
||||
if (!varname.empty())
|
||||
{
|
||||
// FIXME: LOCATION is slightly wrong here.
|
||||
|
@ -4297,6 +4298,7 @@ Parse::comm_clause(Select_clauses* clauses, bool* saw_default)
|
|||
var = this->gogo_->add_variable(varname, v);
|
||||
}
|
||||
|
||||
Named_object* closedvar = NULL;
|
||||
if (!closedname.empty())
|
||||
{
|
||||
// FIXME: LOCATION is slightly wrong here.
|
||||
|
@ -4306,8 +4308,8 @@ Parse::comm_clause(Select_clauses* clauses, bool* saw_default)
|
|||
}
|
||||
|
||||
this->statement_list();
|
||||
statements = this->gogo_->finish_block(this->location());
|
||||
}
|
||||
|
||||
Block* statements = this->gogo_->finish_block(this->location());
|
||||
|
||||
if (is_default)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue