loop scope
This commit is contained in:
parent
c2c64145cb
commit
7570d85869
1 changed files with 18 additions and 0 deletions
|
@ -180,6 +180,11 @@ fn compute_expr_scopes(expr: ast::Expr, scopes: &mut FnScopes, scope: ScopeId) {
|
|||
.chain(e.expr())
|
||||
.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()
|
||||
.filter_map(ast::Expr::cast)
|
||||
|
@ -255,4 +260,17 @@ mod tests {
|
|||
&["x"],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_loop_scope() {
|
||||
do_check(r"
|
||||
fn quux() {
|
||||
loop {
|
||||
let x = ();
|
||||
<|>
|
||||
};
|
||||
}",
|
||||
&["x"],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue