diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/from_source.rs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs index b3ed88b6b..4fd7c7573 100644 --- a/crates/ra_hir/src/from_source.rs +++ b/crates/ra_hir/src/from_source.rs | |||
@@ -216,21 +216,30 @@ fn analyze_container(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> DynMap | |||
216 | } | 216 | } |
217 | 217 | ||
218 | fn _analyze_container(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> Option<DynMap> { | 218 | fn _analyze_container(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> Option<DynMap> { |
219 | // FIXME: this doesn't try to handle nested declarations | ||
220 | for container in src.value.ancestors().skip(1) { | 219 | for container in src.value.ancestors().skip(1) { |
221 | let res = match_ast! { | 220 | let res = match_ast! { |
222 | match container { | 221 | match container { |
223 | ast::TraitDef(it) => { | 222 | ast::TraitDef(it) => { |
224 | let c = Trait::from_source(db, src.with_value(it))?; | 223 | let def = Trait::from_source(db, src.with_value(it))?; |
225 | c.id.child_by_source(db) | 224 | def.id.child_by_source(db) |
226 | }, | 225 | }, |
227 | ast::ImplBlock(it) => { | 226 | ast::ImplBlock(it) => { |
228 | let c = ImplBlock::from_source(db, src.with_value(it))?; | 227 | let def = ImplBlock::from_source(db, src.with_value(it))?; |
229 | c.id.child_by_source(db) | 228 | def.id.child_by_source(db) |
230 | }, | 229 | }, |
231 | ast::FnDef(it) => { | 230 | ast::FnDef(it) => { |
232 | let f = Function::from_source(db, src.with_value(it))?; | 231 | let def = Function::from_source(db, src.with_value(it))?; |
233 | DefWithBodyId::from(f.id) | 232 | DefWithBodyId::from(def.id) |
233 | .child_by_source(db) | ||
234 | }, | ||
235 | ast::StaticDef(it) => { | ||
236 | let def = Static::from_source(db, src.with_value(it))?; | ||
237 | DefWithBodyId::from(def.id) | ||
238 | .child_by_source(db) | ||
239 | }, | ||
240 | ast::ConstDef(it) => { | ||
241 | let def = Const::from_source(db, src.with_value(it))?; | ||
242 | DefWithBodyId::from(def.id) | ||
234 | .child_by_source(db) | 243 | .child_by_source(db) |
235 | }, | 244 | }, |
236 | _ => { continue }, | 245 | _ => { continue }, |