aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_db')
-rw-r--r--crates/ide_db/src/call_info.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/crates/ide_db/src/call_info.rs b/crates/ide_db/src/call_info.rs
index 7e26c3ccf..e583a52f4 100644
--- a/crates/ide_db/src/call_info.rs
+++ b/crates/ide_db/src/call_info.rs
@@ -4,7 +4,7 @@ use either::Either;
4use hir::{HasAttrs, HirDisplay, Semantics, Type}; 4use hir::{HasAttrs, HirDisplay, Semantics, Type};
5use stdx::format_to; 5use stdx::format_to;
6use syntax::{ 6use syntax::{
7 ast::{self, ArgListOwner}, 7 ast::{self, ArgListOwner, NameOwner},
8 match_ast, AstNode, SyntaxNode, SyntaxToken, TextRange, TextSize, 8 match_ast, AstNode, SyntaxNode, SyntaxToken, TextRange, TextSize,
9}; 9};
10 10
@@ -142,7 +142,7 @@ fn call_info_impl(
142#[derive(Debug)] 142#[derive(Debug)]
143pub struct ActiveParameter { 143pub struct ActiveParameter {
144 pub ty: Type, 144 pub ty: Type,
145 pub name: String, 145 pub pat: Either<ast::SelfParam, ast::Pat>,
146} 146}
147 147
148impl ActiveParameter { 148impl ActiveParameter {
@@ -165,8 +165,14 @@ impl ActiveParameter {
165 return None; 165 return None;
166 } 166 }
167 let (pat, ty) = params.swap_remove(idx); 167 let (pat, ty) = params.swap_remove(idx);
168 let name = pat?.to_string(); 168 pat.map(|pat| ActiveParameter { ty, pat })
169 Some(ActiveParameter { ty, name }) 169 }
170
171 pub fn ident(&self) -> Option<ast::Name> {
172 self.pat.as_ref().right().and_then(|param| match param {
173 ast::Pat::IdentPat(ident) => ident.name(),
174 _ => None,
175 })
170 } 176 }
171} 177}
172 178