diff options
Diffstat (limited to 'crates/hir_def/src/item_tree')
-rw-r--r-- | crates/hir_def/src/item_tree/lower.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs index 3328639cf..2ffa46ac0 100644 --- a/crates/hir_def/src/item_tree/lower.rs +++ b/crates/hir_def/src/item_tree/lower.rs | |||
@@ -283,6 +283,7 @@ impl Ctx { | |||
283 | let name = func.name()?.as_name(); | 283 | let name = func.name()?.as_name(); |
284 | 284 | ||
285 | let mut params = Vec::new(); | 285 | let mut params = Vec::new(); |
286 | let mut param_names = Vec::new(); | ||
286 | let mut has_self_param = false; | 287 | let mut has_self_param = false; |
287 | if let Some(param_list) = func.param_list() { | 288 | if let Some(param_list) = func.param_list() { |
288 | if let Some(self_param) = param_list.self_param() { | 289 | if let Some(self_param) = param_list.self_param() { |
@@ -305,6 +306,18 @@ impl Ctx { | |||
305 | has_self_param = true; | 306 | has_self_param = true; |
306 | } | 307 | } |
307 | for param in param_list.params() { | 308 | for param in param_list.params() { |
309 | let param_name = param | ||
310 | .pat() | ||
311 | .map(|name| { | ||
312 | if let ast::Pat::IdentPat(ident) = name { | ||
313 | Some(ident.name()?.as_name()) | ||
314 | } else { | ||
315 | None | ||
316 | } | ||
317 | }) | ||
318 | .flatten(); | ||
319 | param_names.push(param_name); | ||
320 | |||
308 | let type_ref = TypeRef::from_ast_opt(&self.body_ctx, param.ty()); | 321 | let type_ref = TypeRef::from_ast_opt(&self.body_ctx, param.ty()); |
309 | params.push(type_ref); | 322 | params.push(type_ref); |
310 | } | 323 | } |
@@ -341,6 +354,7 @@ impl Ctx { | |||
341 | has_body, | 354 | has_body, |
342 | is_unsafe: func.unsafe_token().is_some(), | 355 | is_unsafe: func.unsafe_token().is_some(), |
343 | params: params.into_boxed_slice(), | 356 | params: params.into_boxed_slice(), |
357 | param_names: param_names.into_boxed_slice(), | ||
344 | is_varargs, | 358 | is_varargs, |
345 | ret_type, | 359 | ret_type, |
346 | ast_id, | 360 | ast_id, |