From f4c5383103e2b79b05e2669889d44e51988932a6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 2 Mar 2019 16:18:40 +0300 Subject: dont store body inside source map --- crates/ra_hir/src/expr/scope.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/ra_hir/src/expr') diff --git a/crates/ra_hir/src/expr/scope.rs b/crates/ra_hir/src/expr/scope.rs index bb919dcfa..d5824eb81 100644 --- a/crates/ra_hir/src/expr/scope.rs +++ b/crates/ra_hir/src/expr/scope.rs @@ -316,11 +316,11 @@ mod tests { let marker: &ast::PathExpr = find_node_at_offset(file.syntax(), off).unwrap(); let fn_def: &ast::FnDef = find_node_at_offset(file.syntax(), off).unwrap(); let irrelevant_function = Function { id: crate::ids::FunctionId::from_raw(0.into()) }; - let body_hir = expr::collect_fn_body_syntax(irrelevant_function, fn_def); - let scopes = ExprScopes::new(Arc::clone(body_hir.body())); + let (body, syntax_mapping) = expr::collect_fn_body_syntax(irrelevant_function, fn_def); + let scopes = ExprScopes::new(Arc::new(body)); let scopes = ScopesWithSyntaxMapping { scopes: Arc::new(scopes), - syntax_mapping: Arc::new(body_hir), + syntax_mapping: Arc::new(syntax_mapping), }; let actual = scopes .scope_chain(marker.syntax()) @@ -417,11 +417,11 @@ mod tests { let name_ref: &ast::NameRef = find_node_at_offset(file.syntax(), off).unwrap(); let irrelevant_function = Function { id: crate::ids::FunctionId::from_raw(0.into()) }; - let body_hir = expr::collect_fn_body_syntax(irrelevant_function, fn_def); - let scopes = ExprScopes::new(Arc::clone(body_hir.body())); + let (body, syntax_mapping) = expr::collect_fn_body_syntax(irrelevant_function, fn_def); + let scopes = ExprScopes::new(Arc::new(body)); let scopes = ScopesWithSyntaxMapping { scopes: Arc::new(scopes), - syntax_mapping: Arc::new(body_hir), + syntax_mapping: Arc::new(syntax_mapping), }; let local_name_entry = scopes.resolve_local_name(name_ref).unwrap(); let local_name = local_name_entry.ptr(); -- cgit v1.2.3