aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/code_model_api.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/code_model_api.rs')
-rw-r--r--crates/ra_hir/src/code_model_api.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs
index 0779a08a9..29c08e34b 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model_api.rs
@@ -626,6 +626,23 @@ impl Type {
626 let module_impls = db.impls_in_module(self.module(db)); 626 let module_impls = db.impls_in_module(self.module(db));
627 ImplBlock::containing(module_impls, (*self).into()) 627 ImplBlock::containing(module_impls, (*self).into())
628 } 628 }
629
630 pub fn type_ref(self, db: &impl PersistentHirDatabase) -> Arc<TypeRef> {
631 db.type_alias_ref(self)
632 }
633
634 /// Builds a resolver for the type references in this type alias.
635 pub fn resolver(&self, db: &impl HirDatabase) -> Resolver {
636 // take the outer scope...
637 let r = self
638 .impl_block(db)
639 .map(|ib| ib.resolver(db))
640 .unwrap_or_else(|| self.module(db).resolver(db));
641 // ...and add generic params, if present
642 let p = self.generic_params(db);
643 let r = if !p.params.is_empty() { r.push_generic_params_scope(p) } else { r };
644 r
645 }
629} 646}
630 647
631impl Docs for Type { 648impl Docs for Type {