From 57518153147ad53639f16cc940d219dc582c550a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 27 Aug 2018 22:03:19 +0300 Subject: Add runnables --- crates/libeditor/src/scope.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'crates/libeditor/src') 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) { compute_block_scopes(block, scopes, scope); } } - // ForExpr(e) => TODO, + ast::Expr::ForExpr(e) => { + if let Some(expr) = e.iterable() { + compute_expr_scopes(expr, scopes, scope); + } + let mut scope = scope; + if let Some(pat) = e.pat() { + scope = scopes.new_scope(scope); + scopes.add_bindings(scope, pat); + } + if let Some(block) = e.body() { + compute_block_scopes(block, scopes, scope); + } + }, _ => { expr.syntax().children() .filter_map(ast::Expr::cast) -- cgit v1.2.3