diff options
Diffstat (limited to 'crates/ra_analysis/src/descriptors/function')
-rw-r--r-- | crates/ra_analysis/src/descriptors/function/imp.rs | 4 | ||||
-rw-r--r-- | crates/ra_analysis/src/descriptors/function/scope.rs | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_analysis/src/descriptors/function/imp.rs b/crates/ra_analysis/src/descriptors/function/imp.rs index 755e05819..a989a04cd 100644 --- a/crates/ra_analysis/src/descriptors/function/imp.rs +++ b/crates/ra_analysis/src/descriptors/function/imp.rs | |||
@@ -11,11 +11,11 @@ use crate::descriptors::{ | |||
11 | /// TODO: this should return something more type-safe then `SyntaxNode` | 11 | /// TODO: this should return something more type-safe then `SyntaxNode` |
12 | pub(crate) fn fn_syntax(db: &impl DescriptorDatabase, fn_id: FnId) -> FnDefNode { | 12 | pub(crate) fn fn_syntax(db: &impl DescriptorDatabase, fn_id: FnId) -> FnDefNode { |
13 | let syntax = db.resolve_syntax_ptr(fn_id.0); | 13 | let syntax = db.resolve_syntax_ptr(fn_id.0); |
14 | FnDef::cast(syntax.borrowed()).unwrap().into() | 14 | FnDef::cast(syntax.borrowed()).unwrap().owned() |
15 | } | 15 | } |
16 | 16 | ||
17 | pub(crate) fn fn_scopes(db: &impl DescriptorDatabase, fn_id: FnId) -> Arc<FnScopes> { | 17 | pub(crate) fn fn_scopes(db: &impl DescriptorDatabase, fn_id: FnId) -> Arc<FnScopes> { |
18 | let syntax = db.fn_syntax(fn_id); | 18 | let syntax = db.fn_syntax(fn_id); |
19 | let res = FnScopes::new(syntax.ast()); | 19 | let res = FnScopes::new(syntax.borrowed()); |
20 | Arc::new(res) | 20 | Arc::new(res) |
21 | } | 21 | } |
diff --git a/crates/ra_analysis/src/descriptors/function/scope.rs b/crates/ra_analysis/src/descriptors/function/scope.rs index 62b46ffba..bbe16947c 100644 --- a/crates/ra_analysis/src/descriptors/function/scope.rs +++ b/crates/ra_analysis/src/descriptors/function/scope.rs | |||
@@ -272,7 +272,7 @@ pub fn resolve_local_name<'a>( | |||
272 | #[cfg(test)] | 272 | #[cfg(test)] |
273 | mod tests { | 273 | mod tests { |
274 | use ra_editor::find_node_at_offset; | 274 | use ra_editor::find_node_at_offset; |
275 | use ra_syntax::File; | 275 | use ra_syntax::SourceFileNode; |
276 | use test_utils::extract_offset; | 276 | use test_utils::extract_offset; |
277 | 277 | ||
278 | use super::*; | 278 | use super::*; |
@@ -287,7 +287,7 @@ mod tests { | |||
287 | buf.push_str(&code[off..]); | 287 | buf.push_str(&code[off..]); |
288 | buf | 288 | buf |
289 | }; | 289 | }; |
290 | let file = File::parse(&code); | 290 | let file = SourceFileNode::parse(&code); |
291 | let marker: ast::PathExpr = find_node_at_offset(file.syntax(), off).unwrap(); | 291 | let marker: ast::PathExpr = find_node_at_offset(file.syntax(), off).unwrap(); |
292 | let fn_def: ast::FnDef = find_node_at_offset(file.syntax(), off).unwrap(); | 292 | let fn_def: ast::FnDef = find_node_at_offset(file.syntax(), off).unwrap(); |
293 | let scopes = FnScopes::new(fn_def); | 293 | let scopes = FnScopes::new(fn_def); |
@@ -376,7 +376,7 @@ mod tests { | |||
376 | 376 | ||
377 | fn do_check_local_name(code: &str, expected_offset: u32) { | 377 | fn do_check_local_name(code: &str, expected_offset: u32) { |
378 | let (off, code) = extract_offset(code); | 378 | let (off, code) = extract_offset(code); |
379 | let file = File::parse(&code); | 379 | let file = SourceFileNode::parse(&code); |
380 | let fn_def: ast::FnDef = find_node_at_offset(file.syntax(), off).unwrap(); | 380 | let fn_def: ast::FnDef = find_node_at_offset(file.syntax(), off).unwrap(); |
381 | let name_ref: ast::NameRef = find_node_at_offset(file.syntax(), off).unwrap(); | 381 | let name_ref: ast::NameRef = find_node_at_offset(file.syntax(), off).unwrap(); |
382 | 382 | ||