From a04177f135be89ddbf1788c6f747c26812e90438 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 20 Dec 2019 11:19:09 +0100 Subject: Add local functions to bodies --- crates/ra_hir/src/from_source.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs index 7abb4bd75..b3ed88b6b 100644 --- a/crates/ra_hir/src/from_source.rs +++ b/crates/ra_hir/src/from_source.rs @@ -1,8 +1,8 @@ //! FIXME: write short doc here use hir_def::{ child_by_source::ChildBySource, dyn_map::DynMap, keys, keys::Key, nameres::ModuleSource, - ConstId, EnumId, EnumVariantId, FunctionId, GenericDefId, ImplId, ModuleId, StaticId, StructId, - TraitId, TypeAliasId, UnionId, VariantId, + ConstId, DefWithBodyId, EnumId, EnumVariantId, FunctionId, GenericDefId, ImplId, ModuleId, + StaticId, StructId, TraitId, TypeAliasId, UnionId, VariantId, }; use hir_expand::{name::AsName, AstId, MacroDefId, MacroDefKind}; use ra_syntax::{ @@ -227,7 +227,12 @@ fn _analyze_container(db: &impl DefDatabase, src: InFile<&SyntaxNode>) -> Option ast::ImplBlock(it) => { let c = ImplBlock::from_source(db, src.with_value(it))?; c.id.child_by_source(db) - }, + }, + ast::FnDef(it) => { + let f = Function::from_source(db, src.with_value(it))?; + DefWithBodyId::from(f.id) + .child_by_source(db) + }, _ => { continue }, } }; -- cgit v1.2.3