diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 42c392513..0e136b904 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -76,12 +76,13 @@ fn def_with_body_from_child_node( | |||
76 | db: &impl HirDatabase, | 76 | db: &impl HirDatabase, |
77 | child: InFile<&SyntaxNode>, | 77 | child: InFile<&SyntaxNode>, |
78 | ) -> Option<DefWithBody> { | 78 | ) -> Option<DefWithBody> { |
79 | child.value.ancestors().find_map(|node| { | 79 | child.cloned().ancestors_with_macros(db).find_map(|node| { |
80 | let n = &node.value; | ||
80 | match_ast! { | 81 | match_ast! { |
81 | match node { | 82 | match n { |
82 | ast::FnDef(def) => { return Function::from_source(db, child.with_value(def)).map(DefWithBody::from); }, | 83 | ast::FnDef(def) => { return Function::from_source(db, node.with_value(def)).map(DefWithBody::from); }, |
83 | ast::ConstDef(def) => { return Const::from_source(db, child.with_value(def)).map(DefWithBody::from); }, | 84 | ast::ConstDef(def) => { return Const::from_source(db, node.with_value(def)).map(DefWithBody::from); }, |
84 | ast::StaticDef(def) => { return Static::from_source(db, child.with_value(def)).map(DefWithBody::from); }, | 85 | ast::StaticDef(def) => { return Static::from_source(db, node.with_value(def)).map(DefWithBody::from); }, |
85 | _ => { None }, | 86 | _ => { None }, |
86 | } | 87 | } |
87 | } | 88 | } |
@@ -135,6 +136,7 @@ pub struct ReferenceDescriptor { | |||
135 | pub name: String, | 136 | pub name: String, |
136 | } | 137 | } |
137 | 138 | ||
139 | #[derive(Debug)] | ||
138 | pub struct Expansion { | 140 | pub struct Expansion { |
139 | macro_file_kind: MacroFileKind, | 141 | macro_file_kind: MacroFileKind, |
140 | macro_call_id: MacroCallId, | 142 | macro_call_id: MacroCallId, |