don't turn semantic errors into parse errors.

llvm-svn: 41638
This commit is contained in:
Chris Lattner 2007-08-31 05:01:50 +00:00
parent c6c66c461f
commit 319079c003
1 changed files with 13 additions and 9 deletions

View File

@ -374,15 +374,19 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, unsigned MinPrec) {
}
assert(NextTokPrec <= ThisPrec && "Recursion didn't work!");
// Combine the LHS and RHS into the LHS (e.g. build AST).
if (TernaryMiddle.isInvalid)
LHS = Actions.ParseBinOp(OpToken.getLocation(), OpToken.getKind(),
LHS.Val, RHS.Val);
else
LHS = Actions.ParseConditionalOp(OpToken.getLocation(), ColonLoc,
LHS.Val, TernaryMiddle.Val, RHS.Val);
if (LHS.isInvalid)
return LHS;
if (!LHS.isInvalid) {
// Combine the LHS and RHS into the LHS (e.g. build AST).
if (TernaryMiddle.isInvalid)
LHS = Actions.ParseBinOp(OpToken.getLocation(), OpToken.getKind(),
LHS.Val, RHS.Val);
else
LHS = Actions.ParseConditionalOp(OpToken.getLocation(), ColonLoc,
LHS.Val, TernaryMiddle.Val, RHS.Val);
} else {
// We had a semantic error on the LHS. Just free the RHS and continue.
Actions.DeleteExpr(TernaryMiddle.Val);
Actions.DeleteExpr(RHS.Val);
}
}
}