aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/grammar/expressions
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/grammar/expressions')
-rw-r--r--crates/ra_syntax/src/grammar/expressions/atom.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs
index 471f398f5..a976799e7 100644
--- a/crates/ra_syntax/src/grammar/expressions/atom.rs
+++ b/crates/ra_syntax/src/grammar/expressions/atom.rs
@@ -61,16 +61,12 @@ pub(super) const ATOM_EXPR_FIRST: TokenSet = token_set_union![
61 61
62const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; 62const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW];
63 63
64pub(super) fn atom_expr( 64pub(super) fn atom_expr(p: &mut Parser, r: Restrictions) -> Option<(CompletedMarker, BlockLike)> {
65 p: &mut Parser,
66 r: Restrictions,
67) -> (Option<CompletedMarker>, Option<BlockLike>) {
68 if let Some(m) = literal(p) { 65 if let Some(m) = literal(p) {
69 return (Some(m), None); 66 return Some((m, BlockLike::NotBlock));
70 } 67 }
71 if paths::is_path_start(p) || p.at(L_ANGLE) { 68 if paths::is_path_start(p) || p.at(L_ANGLE) {
72 let path_expr = path_expr(p, r); 69 return Some(path_expr(p, r));
73 return (Some(path_expr.0), path_expr.1);
74 } 70 }
75 let la = p.nth(1); 71 let la = p.nth(1);
76 let done = match p.current() { 72 let done = match p.current() {
@@ -98,7 +94,7 @@ pub(super) fn atom_expr(
98 // } 94 // }
99 p.error("expected a loop"); 95 p.error("expected a loop");
100 m.complete(p, ERROR); 96 m.complete(p, ERROR);
101 return (None, None); 97 return None;
102 } 98 }
103 } 99 }
104 } 100 }
@@ -115,10 +111,14 @@ pub(super) fn atom_expr(
115 BREAK_KW => break_expr(p), 111 BREAK_KW => break_expr(p),
116 _ => { 112 _ => {
117 p.err_recover("expected expression", EXPR_RECOVERY_SET); 113 p.err_recover("expected expression", EXPR_RECOVERY_SET);
118 return (None, None); 114 return None;
119 } 115 }
120 }; 116 };
121 (Some(done), None) 117 let blocklike = match done.kind() {
118 IF_EXPR | WHILE_EXPR | FOR_EXPR | LOOP_EXPR | MATCH_EXPR | BLOCK_EXPR => BlockLike::Block,
119 _ => BlockLike::NotBlock,
120 };
121 Some((done, blocklike))
122} 122}
123 123
124// test tuple_expr 124// test tuple_expr