Skip to content

Commit

Permalink
Corrects issue rust-lang#28777 by removing, once a binary operator is…
Browse files Browse the repository at this point in the history
… found, the

RESTRICTION_STMT_EXPR restriction to allow subsequent expressions to
contain braces.

rust-lang#28777
  • Loading branch information
aaronkeen committed Dec 14, 2015
1 parent 6b3a3f2 commit 35f2fe5
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2813,16 +2813,25 @@ impl<'a> Parser<'a> {


let rhs = try!(match op.fixity() {
Fixity::Right => self.with_res(restrictions, |this|{
this.parse_assoc_expr_with(op.precedence(), LhsExpr::NotYetParsed)
Fixity::Right => self.with_res(
restrictions & !Restrictions::RESTRICTION_STMT_EXPR,
|this|{
this.parse_assoc_expr_with(op.precedence(),
LhsExpr::NotYetParsed)
}),
Fixity::Left => self.with_res(restrictions, |this|{
this.parse_assoc_expr_with(op.precedence() + 1, LhsExpr::NotYetParsed)
Fixity::Left => self.with_res(
restrictions & !Restrictions::RESTRICTION_STMT_EXPR,
|this|{
this.parse_assoc_expr_with(op.precedence() + 1,
LhsExpr::NotYetParsed)
}),
// We currently have no non-associative operators that are not handled above by
// the special cases. The code is here only for future convenience.
Fixity::None => self.with_res(restrictions, |this|{
this.parse_assoc_expr_with(op.precedence() + 1, LhsExpr::NotYetParsed)
Fixity::None => self.with_res(
restrictions & !Restrictions::RESTRICTION_STMT_EXPR,
|this|{
this.parse_assoc_expr_with(op.precedence() + 1,
LhsExpr::NotYetParsed)
}),
});

Expand Down

0 comments on commit 35f2fe5

Please sign in to comment.