aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/libeditor/src/scope/fn_scope.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crates/libeditor/src/scope/fn_scope.rs b/crates/libeditor/src/scope/fn_scope.rs
index a38647c43..de38b33f0 100644
--- a/crates/libeditor/src/scope/fn_scope.rs
+++ b/crates/libeditor/src/scope/fn_scope.rs
@@ -180,6 +180,11 @@ fn compute_expr_scopes(expr: ast::Expr, scopes: &mut FnScopes, scope: ScopeId) {
180 .chain(e.expr()) 180 .chain(e.expr())
181 .for_each(|expr| compute_expr_scopes(expr, scopes, scope)); 181 .for_each(|expr| compute_expr_scopes(expr, scopes, scope));
182 } 182 }
183 ast::Expr::LoopExpr(e) => {
184 if let Some(block) = e.body() {
185 compute_block_scopes(block, scopes, scope);
186 }
187 }
183 _ => { 188 _ => {
184 expr.syntax().children() 189 expr.syntax().children()
185 .filter_map(ast::Expr::cast) 190 .filter_map(ast::Expr::cast)
@@ -255,4 +260,17 @@ mod tests {
255 &["x"], 260 &["x"],
256 ); 261 );
257 } 262 }
263
264 #[test]
265 fn test_loop_scope() {
266 do_check(r"
267 fn quux() {
268 loop {
269 let x = ();
270 <|>
271 };
272 }",
273 &["x"],
274 );
275 }
258} 276}