diff options
Diffstat (limited to 'crates/hir_def/src/data.rs')
-rw-r--r-- | crates/hir_def/src/data.rs | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/crates/hir_def/src/data.rs b/crates/hir_def/src/data.rs index aea53d527..74a2194e5 100644 --- a/crates/hir_def/src/data.rs +++ b/crates/hir_def/src/data.rs | |||
@@ -9,7 +9,7 @@ use crate::{ | |||
9 | attr::Attrs, | 9 | attr::Attrs, |
10 | body::Expander, | 10 | body::Expander, |
11 | db::DefDatabase, | 11 | db::DefDatabase, |
12 | item_tree::{AssocItem, ItemTreeId, ModItem}, | 12 | item_tree::{AssocItem, FunctionQualifier, ItemTreeId, ModItem}, |
13 | type_ref::{TypeBound, TypeRef}, | 13 | type_ref::{TypeBound, TypeRef}, |
14 | visibility::RawVisibility, | 14 | visibility::RawVisibility, |
15 | AssocContainerId, AssocItemId, ConstId, ConstLoc, FunctionId, FunctionLoc, HasModule, ImplId, | 15 | AssocContainerId, AssocItemId, ConstId, ConstLoc, FunctionId, FunctionLoc, HasModule, ImplId, |
@@ -26,9 +26,9 @@ pub struct FunctionData { | |||
26 | /// can be called as a method. | 26 | /// can be called as a method. |
27 | pub has_self_param: bool, | 27 | pub has_self_param: bool, |
28 | pub has_body: bool, | 28 | pub has_body: bool, |
29 | pub is_unsafe: bool, | 29 | pub qualifier: FunctionQualifier, |
30 | pub is_in_extern_block: bool, | ||
30 | pub is_varargs: bool, | 31 | pub is_varargs: bool, |
31 | pub is_extern: bool, | ||
32 | pub visibility: RawVisibility, | 32 | pub visibility: RawVisibility, |
33 | } | 33 | } |
34 | 34 | ||
@@ -46,9 +46,9 @@ impl FunctionData { | |||
46 | attrs: item_tree.attrs(db, krate, ModItem::from(loc.id.value).into()), | 46 | attrs: item_tree.attrs(db, krate, ModItem::from(loc.id.value).into()), |
47 | has_self_param: func.has_self_param, | 47 | has_self_param: func.has_self_param, |
48 | has_body: func.has_body, | 48 | has_body: func.has_body, |
49 | is_unsafe: func.is_unsafe, | 49 | qualifier: func.qualifier.clone(), |
50 | is_in_extern_block: func.is_in_extern_block, | ||
50 | is_varargs: func.is_varargs, | 51 | is_varargs: func.is_varargs, |
51 | is_extern: func.is_extern, | ||
52 | visibility: item_tree[func.visibility].clone(), | 52 | visibility: item_tree[func.visibility].clone(), |
53 | }) | 53 | }) |
54 | } | 54 | } |
@@ -87,7 +87,10 @@ impl TypeAliasData { | |||
87 | pub struct TraitData { | 87 | pub struct TraitData { |
88 | pub name: Name, | 88 | pub name: Name, |
89 | pub items: Vec<(Name, AssocItemId)>, | 89 | pub items: Vec<(Name, AssocItemId)>, |
90 | pub auto: bool, | 90 | pub is_auto: bool, |
91 | pub is_unsafe: bool, | ||
92 | pub visibility: RawVisibility, | ||
93 | pub bounds: Box<[TypeBound]>, | ||
91 | } | 94 | } |
92 | 95 | ||
93 | impl TraitData { | 96 | impl TraitData { |
@@ -96,10 +99,13 @@ impl TraitData { | |||
96 | let item_tree = db.item_tree(tr_loc.id.file_id); | 99 | let item_tree = db.item_tree(tr_loc.id.file_id); |
97 | let tr_def = &item_tree[tr_loc.id.value]; | 100 | let tr_def = &item_tree[tr_loc.id.value]; |
98 | let name = tr_def.name.clone(); | 101 | let name = tr_def.name.clone(); |
99 | let auto = tr_def.auto; | 102 | let is_auto = tr_def.is_auto; |
103 | let is_unsafe = tr_def.is_unsafe; | ||
100 | let module_id = tr_loc.container; | 104 | let module_id = tr_loc.container; |
101 | let container = AssocContainerId::TraitId(tr); | 105 | let container = AssocContainerId::TraitId(tr); |
102 | let mut expander = Expander::new(db, tr_loc.id.file_id, module_id); | 106 | let mut expander = Expander::new(db, tr_loc.id.file_id, module_id); |
107 | let visibility = item_tree[tr_def.visibility].clone(); | ||
108 | let bounds = tr_def.bounds.clone(); | ||
103 | 109 | ||
104 | let items = collect_items( | 110 | let items = collect_items( |
105 | db, | 111 | db, |
@@ -111,7 +117,7 @@ impl TraitData { | |||
111 | 100, | 117 | 100, |
112 | ); | 118 | ); |
113 | 119 | ||
114 | Arc::new(TraitData { name, items, auto }) | 120 | Arc::new(TraitData { name, items, is_auto, is_unsafe, visibility, bounds }) |
115 | } | 121 | } |
116 | 122 | ||
117 | pub fn associated_types(&self) -> impl Iterator<Item = TypeAliasId> + '_ { | 123 | pub fn associated_types(&self) -> impl Iterator<Item = TypeAliasId> + '_ { |