Better error message for missing condition in if statement.

From-SVN: r171638
This commit is contained in:
Ian Lance Taylor 2011-03-28 22:58:49 +00:00
parent 117614a257
commit 0753192b5b
1 changed files with 6 additions and 0 deletions

View File

@ -3779,6 +3779,12 @@ Parse::if_stat()
if (!this->expression_may_start_here())
cond = Expression::make_error(this->location());
}
if (cond == NULL && this->peek_token()->is_op(OPERATOR_LCURLY))
{
error_at(this->location(),
"missing condition in if statement");
cond = Expression::make_error(this->location());
}
if (cond == NULL)
cond = this->expression(PRECEDENCE_NORMAL, false, false, NULL);
}