aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-07-16 17:24:26 +0100
committerAleksey Kladov <[email protected]>2020-07-16 17:24:26 +0100
commit6da22ed9752b239fcd4e7c75673907ceb1ac6b65 (patch)
tree34bea64bd48b51b0318b3a6e45037eb19aebc233 /crates/ra_hir/src
parenta4e9681c79095d6c10a851cfefe64cf1a3570ec5 (diff)
Redner self as param for call infor for assoc fn call
Diffstat (limited to 'crates/ra_hir/src')
-rw-r--r--crates/ra_hir/src/code_model.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 057dfb82a..eb6a14eda 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -1552,7 +1552,10 @@ impl Callable {
1552 let param_list = src.value.param_list()?; 1552 let param_list = src.value.param_list()?;
1553 param_list.self_param() 1553 param_list.self_param()
1554 } 1554 }
1555 pub fn params(&self, db: &dyn HirDatabase) -> Vec<(Option<ast::Pat>, Type)> { 1555 pub fn params(
1556 &self,
1557 db: &dyn HirDatabase,
1558 ) -> Vec<(Option<Either<ast::SelfParam, ast::Pat>>, Type)> {
1556 let types = self 1559 let types = self
1557 .sig 1560 .sig
1558 .params() 1561 .params()
@@ -1562,7 +1565,14 @@ impl Callable {
1562 let patterns = match self.id { 1565 let patterns = match self.id {
1563 CallableDefId::FunctionId(func) => { 1566 CallableDefId::FunctionId(func) => {
1564 let src = func.lookup(db.upcast()).source(db.upcast()); 1567 let src = func.lookup(db.upcast()).source(db.upcast());
1565 src.value.param_list().map(|it| it.params().map(|it| it.pat())) 1568 src.value.param_list().map(|param_list| {
1569 param_list
1570 .self_param()
1571 .map(|it| Some(Either::Left(it)))
1572 .filter(|_| !self.is_bound_method)
1573 .into_iter()
1574 .chain(param_list.params().map(|it| it.pat().map(Either::Right)))
1575 })
1566 } 1576 }
1567 CallableDefId::StructId(_) => None, 1577 CallableDefId::StructId(_) => None,
1568 CallableDefId::EnumVariantId(_) => None, 1578 CallableDefId::EnumVariantId(_) => None,