diff options
Diffstat (limited to 'crates/libeditor/src/scope.rs')
-rw-r--r-- | crates/libeditor/src/scope.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/libeditor/src/scope.rs b/crates/libeditor/src/scope.rs index 76104b2cf..3d398a74c 100644 --- a/crates/libeditor/src/scope.rs +++ b/crates/libeditor/src/scope.rs | |||
@@ -61,7 +61,19 @@ fn compute_expr_scopes(expr: ast::Expr, scopes: &mut FnScopes, scope: ScopeId) { | |||
61 | compute_block_scopes(block, scopes, scope); | 61 | compute_block_scopes(block, scopes, scope); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | // ForExpr(e) => TODO, | 64 | ast::Expr::ForExpr(e) => { |
65 | if let Some(expr) = e.iterable() { | ||
66 | compute_expr_scopes(expr, scopes, scope); | ||
67 | } | ||
68 | let mut scope = scope; | ||
69 | if let Some(pat) = e.pat() { | ||
70 | scope = scopes.new_scope(scope); | ||
71 | scopes.add_bindings(scope, pat); | ||
72 | } | ||
73 | if let Some(block) = e.body() { | ||
74 | compute_block_scopes(block, scopes, scope); | ||
75 | } | ||
76 | }, | ||
65 | _ => { | 77 | _ => { |
66 | expr.syntax().children() | 78 | expr.syntax().children() |
67 | .filter_map(ast::Expr::cast) | 79 | .filter_map(ast::Expr::cast) |