diff options
Diffstat (limited to 'crates/ra_hir/src/expr')
-rw-r--r-- | crates/ra_hir/src/expr/scope.rs | 12 |
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(); |