mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Allocate ast ids for parameters
This commit is contained in:
parent
3b1b58c225
commit
2b9dde14ab
5 changed files with 34 additions and 20 deletions
|
@ -15,9 +15,7 @@ use crate::{
|
|||
attr::Attrs,
|
||||
db::DefDatabase,
|
||||
expander::{Expander, Mark},
|
||||
item_tree::{
|
||||
self, AssocItem, FnFlags, ItemTree, ItemTreeId, MacroCall, ModItem, Param, TreeId,
|
||||
},
|
||||
item_tree::{self, AssocItem, FnFlags, ItemTree, ItemTreeId, MacroCall, ModItem, TreeId},
|
||||
macro_call_as_call_id, macro_id_to_def_id,
|
||||
nameres::{
|
||||
attr_resolution::ResolvedAttr,
|
||||
|
@ -69,7 +67,7 @@ impl FunctionData {
|
|||
let is_varargs = enabled_params
|
||||
.clone()
|
||||
.next_back()
|
||||
.map_or(false, |param| matches!(item_tree[param], Param::Varargs));
|
||||
.map_or(false, |param| item_tree[param].type_ref.is_none());
|
||||
|
||||
let mut flags = func.flags;
|
||||
if is_varargs {
|
||||
|
@ -105,10 +103,7 @@ impl FunctionData {
|
|||
name: func.name.clone(),
|
||||
params: enabled_params
|
||||
.clone()
|
||||
.filter_map(|id| match &item_tree[id] {
|
||||
Param::Normal(ty) => Some(ty.clone()),
|
||||
Param::Varargs => None,
|
||||
})
|
||||
.filter_map(|id| item_tree[id].type_ref.clone())
|
||||
.collect(),
|
||||
ret_type: func.ret_type.clone(),
|
||||
attrs: item_tree.attrs(db, krate, ModItem::from(loc.id.value).into()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue