aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/expr
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-03-02 13:18:40 +0000
committerAleksey Kladov <[email protected]>2019-03-02 13:18:40 +0000
commitf4c5383103e2b79b05e2669889d44e51988932a6 (patch)
treeff26374ccd6e2dfdfe4491820651614da2d366a2 /crates/ra_hir/src/expr
parenteaf1df26e9903772d40df30dd70c75c38d8cb887 (diff)
dont store body inside source map
Diffstat (limited to 'crates/ra_hir/src/expr')
-rw-r--r--crates/ra_hir/src/expr/scope.rs12
1 files changed, 6 insertions, 6 deletions
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 {
316 let marker: &ast::PathExpr = find_node_at_offset(file.syntax(), off).unwrap(); 316 let marker: &ast::PathExpr = find_node_at_offset(file.syntax(), off).unwrap();
317 let fn_def: &ast::FnDef = find_node_at_offset(file.syntax(), off).unwrap(); 317 let fn_def: &ast::FnDef = find_node_at_offset(file.syntax(), off).unwrap();
318 let irrelevant_function = Function { id: crate::ids::FunctionId::from_raw(0.into()) }; 318 let irrelevant_function = Function { id: crate::ids::FunctionId::from_raw(0.into()) };
319 let body_hir = expr::collect_fn_body_syntax(irrelevant_function, fn_def); 319 let (body, syntax_mapping) = expr::collect_fn_body_syntax(irrelevant_function, fn_def);
320 let scopes = ExprScopes::new(Arc::clone(body_hir.body())); 320 let scopes = ExprScopes::new(Arc::new(body));
321 let scopes = ScopesWithSyntaxMapping { 321 let scopes = ScopesWithSyntaxMapping {
322 scopes: Arc::new(scopes), 322 scopes: Arc::new(scopes),
323 syntax_mapping: Arc::new(body_hir), 323 syntax_mapping: Arc::new(syntax_mapping),
324 }; 324 };
325 let actual = scopes 325 let actual = scopes
326 .scope_chain(marker.syntax()) 326 .scope_chain(marker.syntax())
@@ -417,11 +417,11 @@ mod tests {
417 let name_ref: &ast::NameRef = find_node_at_offset(file.syntax(), off).unwrap(); 417 let name_ref: &ast::NameRef = find_node_at_offset(file.syntax(), off).unwrap();
418 418
419 let irrelevant_function = Function { id: crate::ids::FunctionId::from_raw(0.into()) }; 419 let irrelevant_function = Function { id: crate::ids::FunctionId::from_raw(0.into()) };
420 let body_hir = expr::collect_fn_body_syntax(irrelevant_function, fn_def); 420 let (body, syntax_mapping) = expr::collect_fn_body_syntax(irrelevant_function, fn_def);
421 let scopes = ExprScopes::new(Arc::clone(body_hir.body())); 421 let scopes = ExprScopes::new(Arc::new(body));
422 let scopes = ScopesWithSyntaxMapping { 422 let scopes = ScopesWithSyntaxMapping {
423 scopes: Arc::new(scopes), 423 scopes: Arc::new(scopes),
424 syntax_mapping: Arc::new(body_hir), 424 syntax_mapping: Arc::new(syntax_mapping),
425 }; 425 };
426 let local_name_entry = scopes.resolve_local_name(name_ref).unwrap(); 426 let local_name_entry = scopes.resolve_local_name(name_ref).unwrap();
427 let local_name = local_name_entry.ptr(); 427 let local_name = local_name_entry.ptr();