From 0102fb41337ac0442e689d410bb424d215e9a7bd Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 21 Nov 2019 12:21:46 +0300 Subject: Decouple Resolver --- crates/ra_hir_def/src/traits.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'crates/ra_hir_def/src') diff --git a/crates/ra_hir_def/src/traits.rs b/crates/ra_hir_def/src/traits.rs index 877d73d66..6c2d5b2a9 100644 --- a/crates/ra_hir_def/src/traits.rs +++ b/crates/ra_hir_def/src/traits.rs @@ -11,7 +11,7 @@ use ra_syntax::ast::{self, NameOwner}; use crate::{ db::DefDatabase2, AssocItemId, AstItemDef, ConstLoc, ContainerId, FunctionLoc, Intern, TraitId, - TypeAliasLoc, + TypeAliasId, TypeAliasLoc, }; #[derive(Debug, Clone, PartialEq, Eq)] @@ -56,4 +56,11 @@ impl TraitData { }; Arc::new(TraitData { name, items, auto }) } + + pub fn associated_types(&self) -> impl Iterator + '_ { + self.items.iter().filter_map(|item| match item { + AssocItemId::TypeAliasId(t) => Some(*t), + _ => None, + }) + } } -- cgit v1.2.3