diff options
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 662d3f880..f08827ed3 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -56,7 +56,7 @@ fn try_get_resolver_for_node( | |||
56 | }, | 56 | }, |
57 | _ => { | 57 | _ => { |
58 | if node.kind() == FN_DEF || node.kind() == CONST_DEF || node.kind() == STATIC_DEF { | 58 | if node.kind() == FN_DEF || node.kind() == CONST_DEF || node.kind() == STATIC_DEF { |
59 | Some(def_with_body_from_child_node(db, file_id, node)?.resolver(db)) | 59 | Some(def_with_body_from_child_node(db, Source::new(file_id.into(), node))?.resolver(db)) |
60 | } else { | 60 | } else { |
61 | // FIXME add missing cases | 61 | // FIXME add missing cases |
62 | None | 62 | None |
@@ -68,14 +68,13 @@ fn try_get_resolver_for_node( | |||
68 | 68 | ||
69 | fn def_with_body_from_child_node( | 69 | fn def_with_body_from_child_node( |
70 | db: &impl HirDatabase, | 70 | db: &impl HirDatabase, |
71 | file_id: FileId, | 71 | child: Source<&SyntaxNode>, |
72 | node: &SyntaxNode, | ||
73 | ) -> Option<DefWithBody> { | 72 | ) -> Option<DefWithBody> { |
74 | let src = crate::ModuleSource::from_child_node(db, file_id, node); | 73 | let module_source = crate::ModuleSource::from_child_node(db, child); |
75 | let module = Module::from_definition(db, crate::Source { file_id: file_id.into(), ast: src })?; | 74 | let module = Module::from_definition(db, Source::new(child.file_id, module_source))?; |
76 | let ctx = LocationCtx::new(db, module.id, file_id.into()); | 75 | let ctx = LocationCtx::new(db, module.id, child.file_id); |
77 | 76 | ||
78 | node.ancestors().find_map(|node| { | 77 | child.ast.ancestors().find_map(|node| { |
79 | match_ast! { | 78 | match_ast! { |
80 | match node { | 79 | match node { |
81 | ast::FnDef(def) => { Some(Function {id: ctx.to_def(&def) }.into()) }, | 80 | ast::FnDef(def) => { Some(Function {id: ctx.to_def(&def) }.into()) }, |
@@ -142,7 +141,7 @@ impl SourceAnalyzer { | |||
142 | node: &SyntaxNode, | 141 | node: &SyntaxNode, |
143 | offset: Option<TextUnit>, | 142 | offset: Option<TextUnit>, |
144 | ) -> SourceAnalyzer { | 143 | ) -> SourceAnalyzer { |
145 | let def_with_body = def_with_body_from_child_node(db, file_id, node); | 144 | let def_with_body = def_with_body_from_child_node(db, Source::new(file_id.into(), node)); |
146 | if let Some(def) = def_with_body { | 145 | if let Some(def) = def_with_body { |
147 | let source_map = def.body_source_map(db); | 146 | let source_map = def.body_source_map(db); |
148 | let scopes = def.expr_scopes(db); | 147 | let scopes = def.expr_scopes(db); |