diff options
Diffstat (limited to 'crates/ra_parser')
-rw-r--r-- | crates/ra_parser/src/grammar/expressions.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index 4163a2cf5..0c170ac5e 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs | |||
@@ -278,7 +278,7 @@ fn current_op(p: &Parser) -> (u8, SyntaxKind) { | |||
278 | } | 278 | } |
279 | 279 | ||
280 | // Parses expression with binding power of at least bp. | 280 | // Parses expression with binding power of at least bp. |
281 | fn expr_bp(p: &mut Parser, r: Restrictions, bp: u8) -> (Option<CompletedMarker>, BlockLike) { | 281 | fn expr_bp(p: &mut Parser, mut r: Restrictions, bp: u8) -> (Option<CompletedMarker>, BlockLike) { |
282 | let mut lhs = match lhs(p, r) { | 282 | let mut lhs = match lhs(p, r) { |
283 | Some((lhs, blocklike)) => { | 283 | Some((lhs, blocklike)) => { |
284 | // test stmt_bin_expr_ambiguity | 284 | // test stmt_bin_expr_ambiguity |
@@ -311,6 +311,12 @@ fn expr_bp(p: &mut Parser, r: Restrictions, bp: u8) -> (Option<CompletedMarker>, | |||
311 | let m = lhs.precede(p); | 311 | let m = lhs.precede(p); |
312 | p.bump(op); | 312 | p.bump(op); |
313 | 313 | ||
314 | // test binop_resets_statementness | ||
315 | // fn foo() { | ||
316 | // v = {1}&2; | ||
317 | // } | ||
318 | r = Restrictions { prefer_stmt: false, ..r }; | ||
319 | |||
314 | if is_range { | 320 | if is_range { |
315 | // test postfix_range | 321 | // test postfix_range |
316 | // fn foo() { | 322 | // fn foo() { |
@@ -327,7 +333,7 @@ fn expr_bp(p: &mut Parser, r: Restrictions, bp: u8) -> (Option<CompletedMarker>, | |||
327 | } | 333 | } |
328 | } | 334 | } |
329 | 335 | ||
330 | expr_bp(p, r, op_bp + 1); | 336 | expr_bp(p, Restrictions { prefer_stmt: false, ..r }, op_bp + 1); |
331 | lhs = m.complete(p, if is_range { RANGE_EXPR } else { BIN_EXPR }); | 337 | lhs = m.complete(p, if is_range { RANGE_EXPR } else { BIN_EXPR }); |
332 | } | 338 | } |
333 | (Some(lhs), BlockLike::NotBlock) | 339 | (Some(lhs), BlockLike::NotBlock) |