loop scope
This commit is contained in:
parent
c2c64145cb
commit
7570d85869
@ -180,6 +180,11 @@ fn compute_expr_scopes(expr: ast::Expr, scopes: &mut FnScopes, scope: ScopeId) {
|
|||||||
.chain(e.expr())
|
.chain(e.expr())
|
||||||
.for_each(|expr| compute_expr_scopes(expr, scopes, scope));
|
.for_each(|expr| compute_expr_scopes(expr, scopes, scope));
|
||||||
}
|
}
|
||||||
|
ast::Expr::LoopExpr(e) => {
|
||||||
|
if let Some(block) = e.body() {
|
||||||
|
compute_block_scopes(block, scopes, scope);
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
expr.syntax().children()
|
expr.syntax().children()
|
||||||
.filter_map(ast::Expr::cast)
|
.filter_map(ast::Expr::cast)
|
||||||
@ -255,4 +260,17 @@ mod tests {
|
|||||||
&["x"],
|
&["x"],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_loop_scope() {
|
||||||
|
do_check(r"
|
||||||
|
fn quux() {
|
||||||
|
loop {
|
||||||
|
let x = ();
|
||||||
|
<|>
|
||||||
|
};
|
||||||
|
}",
|
||||||
|
&["x"],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user