aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/source_binder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/source_binder.rs')
-rw-r--r--crates/ra_hir/src/source_binder.rs27
1 files changed, 25 insertions, 2 deletions
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 82e6eb852..a4ca59bba 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -327,7 +327,30 @@ impl SourceAnalyzer {
327 db: &impl HirDatabase, 327 db: &impl HirDatabase,
328 ty: Ty, 328 ty: Ty,
329 name: Option<&Name>, 329 name: Option<&Name>,
330 mode: method_resolution::LookupMode, 330 mut callback: impl FnMut(&Ty, Function) -> Option<T>,
331 ) -> Option<T> {
332 // There should be no inference vars in types passed here
333 // FIXME check that?
334 // FIXME replace Unknown by bound vars here
335 let canonical = crate::ty::Canonical { value: ty, num_vars: 0 };
336 method_resolution::iterate_method_candidates(
337 &canonical,
338 db,
339 &self.resolver,
340 name,
341 method_resolution::LookupMode::MethodCall,
342 |ty, it| match it {
343 AssocItem::Function(f) => callback(ty, f),
344 _ => None,
345 },
346 )
347 }
348
349 pub fn iterate_path_candidates<T>(
350 &self,
351 db: &impl HirDatabase,
352 ty: Ty,
353 name: Option<&Name>,
331 callback: impl FnMut(&Ty, AssocItem) -> Option<T>, 354 callback: impl FnMut(&Ty, AssocItem) -> Option<T>,
332 ) -> Option<T> { 355 ) -> Option<T> {
333 // There should be no inference vars in types passed here 356 // There should be no inference vars in types passed here
@@ -339,7 +362,7 @@ impl SourceAnalyzer {
339 db, 362 db,
340 &self.resolver, 363 &self.resolver,
341 name, 364 name,
342 mode, 365 method_resolution::LookupMode::Path,
343 callback, 366 callback,
344 ) 367 )
345 } 368 }