aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/body/lower.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/body/lower.rs')
-rw-r--r--crates/ra_hir_def/src/body/lower.rs26
1 files changed, 19 insertions, 7 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 0103a1aab..0d3f946df 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -25,7 +25,7 @@ use crate::{
25 path::GenericArgs, 25 path::GenericArgs,
26 path::Path, 26 path::Path,
27 type_ref::{Mutability, TypeRef}, 27 type_ref::{Mutability, TypeRef},
28 ContainerId, DefWithBodyId, FunctionLoc, Intern, 28 ContainerId, DefWithBodyId, EnumLoc, FunctionLoc, Intern, ModuleDefId, StructLoc, UnionLoc,
29}; 29};
30 30
31pub(super) fn lower( 31pub(super) fn lower(
@@ -490,16 +490,28 @@ where
490 } 490 }
491 491
492 fn collect_block_items(&mut self, block: &ast::Block) { 492 fn collect_block_items(&mut self, block: &ast::Block) {
493 let container = ContainerId::DefWithBodyId(self.def).into(); 493 let container = ContainerId::DefWithBodyId(self.def);
494 for item in block.items() { 494 for item in block.items() {
495 match item { 495 let def: ModuleDefId = match item {
496 ast::ModuleItem::FnDef(def) => { 496 ast::ModuleItem::FnDef(def) => {
497 let ast_id = self.expander.ast_id(&def); 497 let ast_id = self.expander.ast_id(&def);
498 self.body.defs.push(FunctionLoc { container, ast_id }.intern(self.db).into()) 498 FunctionLoc { container: container.into(), ast_id }.intern(self.db).into()
499 } 499 }
500 // FIXME: handle other items 500 ast::ModuleItem::StructDef(def) => {
501 _ => (), 501 let ast_id = self.expander.ast_id(&def);
502 } 502 StructLoc { container, ast_id }.intern(self.db).into()
503 }
504 ast::ModuleItem::EnumDef(def) => {
505 let ast_id = self.expander.ast_id(&def);
506 EnumLoc { container, ast_id }.intern(self.db).into()
507 }
508 ast::ModuleItem::UnionDef(def) => {
509 let ast_id = self.expander.ast_id(&def);
510 UnionLoc { container, ast_id }.intern(self.db).into()
511 }
512 _ => continue,
513 };
514 self.body.defs.push(def)
503 } 515 }
504 } 516 }
505 517