diff options
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index bd035ced9..f1bb13bc6 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -18,7 +18,7 @@ use ra_syntax::{ | |||
18 | 18 | ||
19 | use crate::{ | 19 | use crate::{ |
20 | HirDatabase, Function, Struct, Enum, Const, Static, Either, DefWithBody, PerNs, Name, | 20 | HirDatabase, Function, Struct, Enum, Const, Static, Either, DefWithBody, PerNs, Name, |
21 | AsName, Module, HirFileId, Crate, Trait, Resolver, | 21 | AsName, Module, HirFileId, Crate, Trait, Resolver, Ty, |
22 | expr::{BodySourceMap, scope::{ScopeId, ExprScopes}}, | 22 | expr::{BodySourceMap, scope::{ScopeId, ExprScopes}}, |
23 | ids::LocationCtx, | 23 | ids::LocationCtx, |
24 | expr, AstId | 24 | expr, AstId |
@@ -343,6 +343,16 @@ impl SourceAnalyzer { | |||
343 | .collect() | 343 | .collect() |
344 | } | 344 | } |
345 | 345 | ||
346 | pub fn iterate_method_candidates<T>( | ||
347 | &self, | ||
348 | db: &impl HirDatabase, | ||
349 | ty: Ty, | ||
350 | name: Option<&Name>, | ||
351 | callback: impl FnMut(&Ty, Function) -> Option<T>, | ||
352 | ) -> Option<T> { | ||
353 | ty.iterate_method_candidates(db, &self.resolver, name, callback) | ||
354 | } | ||
355 | |||
346 | #[cfg(test)] | 356 | #[cfg(test)] |
347 | pub(crate) fn body_source_map(&self) -> Arc<BodySourceMap> { | 357 | pub(crate) fn body_source_map(&self) -> Arc<BodySourceMap> { |
348 | self.body_source_map.clone().unwrap() | 358 | self.body_source_map.clone().unwrap() |