diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated')
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 768 |
1 files changed, 384 insertions, 384 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 04a4d354c..3c8bdfcad 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -26,6 +26,57 @@ impl Attr { | |||
26 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 26 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
27 | } | 27 | } |
28 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 28 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
29 | pub struct ConstDef { | ||
30 | pub(crate) syntax: SyntaxNode, | ||
31 | } | ||
32 | impl ast::AttrsOwner for ConstDef {} | ||
33 | impl ast::NameOwner for ConstDef {} | ||
34 | impl ast::VisibilityOwner for ConstDef {} | ||
35 | impl ast::TypeAscriptionOwner for ConstDef {} | ||
36 | impl ConstDef { | ||
37 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | ||
38 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
39 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
40 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
41 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
42 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
43 | } | ||
44 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
45 | pub struct EnumDef { | ||
46 | pub(crate) syntax: SyntaxNode, | ||
47 | } | ||
48 | impl ast::AttrsOwner for EnumDef {} | ||
49 | impl ast::NameOwner for EnumDef {} | ||
50 | impl ast::VisibilityOwner for EnumDef {} | ||
51 | impl ast::TypeParamsOwner for EnumDef {} | ||
52 | impl EnumDef { | ||
53 | pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) } | ||
54 | pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) } | ||
55 | } | ||
56 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
57 | pub struct ExternBlock { | ||
58 | pub(crate) syntax: SyntaxNode, | ||
59 | } | ||
60 | impl ast::AttrsOwner for ExternBlock {} | ||
61 | impl ExternBlock { | ||
62 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | ||
63 | pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } | ||
64 | } | ||
65 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
66 | pub struct ExternCrateItem { | ||
67 | pub(crate) syntax: SyntaxNode, | ||
68 | } | ||
69 | impl ast::AttrsOwner for ExternCrateItem {} | ||
70 | impl ast::VisibilityOwner for ExternCrateItem {} | ||
71 | impl ExternCrateItem { | ||
72 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } | ||
73 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | ||
74 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
75 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
76 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } | ||
77 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
78 | } | ||
79 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
29 | pub struct FnDef { | 80 | pub struct FnDef { |
30 | pub(crate) syntax: SyntaxNode, | 81 | pub(crate) syntax: SyntaxNode, |
31 | } | 82 | } |
@@ -46,6 +97,131 @@ impl FnDef { | |||
46 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 97 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
47 | } | 98 | } |
48 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 99 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
100 | pub struct ImplDef { | ||
101 | pub(crate) syntax: SyntaxNode, | ||
102 | } | ||
103 | impl ast::AttrsOwner for ImplDef {} | ||
104 | impl ast::VisibilityOwner for ImplDef {} | ||
105 | impl ast::TypeParamsOwner for ImplDef {} | ||
106 | impl ImplDef { | ||
107 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
108 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | ||
109 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
110 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } | ||
111 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
112 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | ||
113 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | ||
114 | } | ||
115 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
116 | pub struct MacroCall { | ||
117 | pub(crate) syntax: SyntaxNode, | ||
118 | } | ||
119 | impl ast::AttrsOwner for MacroCall {} | ||
120 | impl ast::NameOwner for MacroCall {} | ||
121 | impl MacroCall { | ||
122 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
123 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
124 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
125 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
126 | } | ||
127 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
128 | pub struct Module { | ||
129 | pub(crate) syntax: SyntaxNode, | ||
130 | } | ||
131 | impl ast::AttrsOwner for Module {} | ||
132 | impl ast::NameOwner for Module {} | ||
133 | impl ast::VisibilityOwner for Module {} | ||
134 | impl Module { | ||
135 | pub fn mod_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mod]) } | ||
136 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | ||
137 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
138 | } | ||
139 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
140 | pub struct StaticDef { | ||
141 | pub(crate) syntax: SyntaxNode, | ||
142 | } | ||
143 | impl ast::AttrsOwner for StaticDef {} | ||
144 | impl ast::NameOwner for StaticDef {} | ||
145 | impl ast::VisibilityOwner for StaticDef {} | ||
146 | impl ast::TypeAscriptionOwner for StaticDef {} | ||
147 | impl StaticDef { | ||
148 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } | ||
149 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
150 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
151 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
152 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
153 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
154 | } | ||
155 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
156 | pub struct StructDef { | ||
157 | pub(crate) syntax: SyntaxNode, | ||
158 | } | ||
159 | impl ast::AttrsOwner for StructDef {} | ||
160 | impl ast::NameOwner for StructDef {} | ||
161 | impl ast::VisibilityOwner for StructDef {} | ||
162 | impl ast::TypeParamsOwner for StructDef {} | ||
163 | impl StructDef { | ||
164 | pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } | ||
165 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
166 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } | ||
167 | } | ||
168 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
169 | pub struct TraitDef { | ||
170 | pub(crate) syntax: SyntaxNode, | ||
171 | } | ||
172 | impl ast::AttrsOwner for TraitDef {} | ||
173 | impl ast::NameOwner for TraitDef {} | ||
174 | impl ast::VisibilityOwner for TraitDef {} | ||
175 | impl ast::TypeParamsOwner for TraitDef {} | ||
176 | impl ast::TypeBoundsOwner for TraitDef {} | ||
177 | impl TraitDef { | ||
178 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
179 | pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) } | ||
180 | pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } | ||
181 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | ||
182 | } | ||
183 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
184 | pub struct TypeAliasDef { | ||
185 | pub(crate) syntax: SyntaxNode, | ||
186 | } | ||
187 | impl ast::AttrsOwner for TypeAliasDef {} | ||
188 | impl ast::NameOwner for TypeAliasDef {} | ||
189 | impl ast::VisibilityOwner for TypeAliasDef {} | ||
190 | impl ast::TypeParamsOwner for TypeAliasDef {} | ||
191 | impl ast::TypeBoundsOwner for TypeAliasDef {} | ||
192 | impl TypeAliasDef { | ||
193 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | ||
194 | pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } | ||
195 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
196 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
197 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
198 | } | ||
199 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
200 | pub struct UnionDef { | ||
201 | pub(crate) syntax: SyntaxNode, | ||
202 | } | ||
203 | impl ast::AttrsOwner for UnionDef {} | ||
204 | impl ast::NameOwner for UnionDef {} | ||
205 | impl ast::VisibilityOwner for UnionDef {} | ||
206 | impl ast::TypeParamsOwner for UnionDef {} | ||
207 | impl UnionDef { | ||
208 | pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } | ||
209 | pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { | ||
210 | support::child(&self.syntax) | ||
211 | } | ||
212 | } | ||
213 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
214 | pub struct UseItem { | ||
215 | pub(crate) syntax: SyntaxNode, | ||
216 | } | ||
217 | impl ast::AttrsOwner for UseItem {} | ||
218 | impl ast::VisibilityOwner for UseItem {} | ||
219 | impl UseItem { | ||
220 | pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) } | ||
221 | pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } | ||
222 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
223 | } | ||
224 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
49 | pub struct Visibility { | 225 | pub struct Visibility { |
50 | pub(crate) syntax: SyntaxNode, | 226 | pub(crate) syntax: SyntaxNode, |
51 | } | 227 | } |
@@ -122,19 +298,6 @@ impl BlockExpr { | |||
122 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 298 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
123 | } | 299 | } |
124 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 300 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
125 | pub struct StructDef { | ||
126 | pub(crate) syntax: SyntaxNode, | ||
127 | } | ||
128 | impl ast::AttrsOwner for StructDef {} | ||
129 | impl ast::NameOwner for StructDef {} | ||
130 | impl ast::VisibilityOwner for StructDef {} | ||
131 | impl ast::TypeParamsOwner for StructDef {} | ||
132 | impl StructDef { | ||
133 | pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } | ||
134 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
135 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } | ||
136 | } | ||
137 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
138 | pub struct RecordFieldDefList { | 301 | pub struct RecordFieldDefList { |
139 | pub(crate) syntax: SyntaxNode, | 302 | pub(crate) syntax: SyntaxNode, |
140 | } | 303 | } |
@@ -153,20 +316,6 @@ impl TupleFieldDefList { | |||
153 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 316 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
154 | } | 317 | } |
155 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 318 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
156 | pub struct UnionDef { | ||
157 | pub(crate) syntax: SyntaxNode, | ||
158 | } | ||
159 | impl ast::AttrsOwner for UnionDef {} | ||
160 | impl ast::NameOwner for UnionDef {} | ||
161 | impl ast::VisibilityOwner for UnionDef {} | ||
162 | impl ast::TypeParamsOwner for UnionDef {} | ||
163 | impl UnionDef { | ||
164 | pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } | ||
165 | pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { | ||
166 | support::child(&self.syntax) | ||
167 | } | ||
168 | } | ||
169 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
170 | pub struct RecordFieldDef { | 319 | pub struct RecordFieldDef { |
171 | pub(crate) syntax: SyntaxNode, | 320 | pub(crate) syntax: SyntaxNode, |
172 | } | 321 | } |
@@ -188,18 +337,6 @@ impl TupleFieldDef { | |||
188 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 337 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
189 | } | 338 | } |
190 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 339 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
191 | pub struct EnumDef { | ||
192 | pub(crate) syntax: SyntaxNode, | ||
193 | } | ||
194 | impl ast::AttrsOwner for EnumDef {} | ||
195 | impl ast::NameOwner for EnumDef {} | ||
196 | impl ast::VisibilityOwner for EnumDef {} | ||
197 | impl ast::TypeParamsOwner for EnumDef {} | ||
198 | impl EnumDef { | ||
199 | pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) } | ||
200 | pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) } | ||
201 | } | ||
202 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
203 | pub struct EnumVariantList { | 340 | pub struct EnumVariantList { |
204 | pub(crate) syntax: SyntaxNode, | 341 | pub(crate) syntax: SyntaxNode, |
205 | } | 342 | } |
@@ -221,21 +358,6 @@ impl EnumVariant { | |||
221 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 358 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
222 | } | 359 | } |
223 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 360 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
224 | pub struct TraitDef { | ||
225 | pub(crate) syntax: SyntaxNode, | ||
226 | } | ||
227 | impl ast::AttrsOwner for TraitDef {} | ||
228 | impl ast::NameOwner for TraitDef {} | ||
229 | impl ast::VisibilityOwner for TraitDef {} | ||
230 | impl ast::TypeParamsOwner for TraitDef {} | ||
231 | impl ast::TypeBoundsOwner for TraitDef {} | ||
232 | impl TraitDef { | ||
233 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
234 | pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) } | ||
235 | pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } | ||
236 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | ||
237 | } | ||
238 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
239 | pub struct TypeBoundList { | 361 | pub struct TypeBoundList { |
240 | pub(crate) syntax: SyntaxNode, | 362 | pub(crate) syntax: SyntaxNode, |
241 | } | 363 | } |
@@ -253,82 +375,6 @@ impl ItemList { | |||
253 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 375 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
254 | } | 376 | } |
255 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 377 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
256 | pub struct Module { | ||
257 | pub(crate) syntax: SyntaxNode, | ||
258 | } | ||
259 | impl ast::AttrsOwner for Module {} | ||
260 | impl ast::NameOwner for Module {} | ||
261 | impl ast::VisibilityOwner for Module {} | ||
262 | impl Module { | ||
263 | pub fn mod_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mod]) } | ||
264 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | ||
265 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
266 | } | ||
267 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
268 | pub struct ConstDef { | ||
269 | pub(crate) syntax: SyntaxNode, | ||
270 | } | ||
271 | impl ast::AttrsOwner for ConstDef {} | ||
272 | impl ast::NameOwner for ConstDef {} | ||
273 | impl ast::VisibilityOwner for ConstDef {} | ||
274 | impl ast::TypeAscriptionOwner for ConstDef {} | ||
275 | impl ConstDef { | ||
276 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | ||
277 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
278 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
279 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
280 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
281 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
282 | } | ||
283 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
284 | pub struct StaticDef { | ||
285 | pub(crate) syntax: SyntaxNode, | ||
286 | } | ||
287 | impl ast::AttrsOwner for StaticDef {} | ||
288 | impl ast::NameOwner for StaticDef {} | ||
289 | impl ast::VisibilityOwner for StaticDef {} | ||
290 | impl ast::TypeAscriptionOwner for StaticDef {} | ||
291 | impl StaticDef { | ||
292 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } | ||
293 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
294 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
295 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
296 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
297 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
298 | } | ||
299 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
300 | pub struct TypeAliasDef { | ||
301 | pub(crate) syntax: SyntaxNode, | ||
302 | } | ||
303 | impl ast::AttrsOwner for TypeAliasDef {} | ||
304 | impl ast::NameOwner for TypeAliasDef {} | ||
305 | impl ast::VisibilityOwner for TypeAliasDef {} | ||
306 | impl ast::TypeParamsOwner for TypeAliasDef {} | ||
307 | impl ast::TypeBoundsOwner for TypeAliasDef {} | ||
308 | impl TypeAliasDef { | ||
309 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | ||
310 | pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } | ||
311 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
312 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
313 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
314 | } | ||
315 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
316 | pub struct ImplDef { | ||
317 | pub(crate) syntax: SyntaxNode, | ||
318 | } | ||
319 | impl ast::AttrsOwner for ImplDef {} | ||
320 | impl ast::VisibilityOwner for ImplDef {} | ||
321 | impl ast::TypeParamsOwner for ImplDef {} | ||
322 | impl ImplDef { | ||
323 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
324 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | ||
325 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
326 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } | ||
327 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
328 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | ||
329 | pub fn item_list(&self) -> Option<ItemList> { support::child(&self.syntax) } | ||
330 | } | ||
331 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
332 | pub struct ParenType { | 378 | pub struct ParenType { |
333 | pub(crate) syntax: SyntaxNode, | 379 | pub(crate) syntax: SyntaxNode, |
334 | } | 380 | } |
@@ -920,18 +966,6 @@ impl MacroPat { | |||
920 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } | 966 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } |
921 | } | 967 | } |
922 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 968 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
923 | pub struct MacroCall { | ||
924 | pub(crate) syntax: SyntaxNode, | ||
925 | } | ||
926 | impl ast::AttrsOwner for MacroCall {} | ||
927 | impl ast::NameOwner for MacroCall {} | ||
928 | impl MacroCall { | ||
929 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
930 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | ||
931 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
932 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
933 | } | ||
934 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
935 | pub struct RecordPat { | 969 | pub struct RecordPat { |
936 | pub(crate) syntax: SyntaxNode, | 970 | pub(crate) syntax: SyntaxNode, |
937 | } | 971 | } |
@@ -1125,17 +1159,6 @@ impl Param { | |||
1125 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } | 1159 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } |
1126 | } | 1160 | } |
1127 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1161 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1128 | pub struct UseItem { | ||
1129 | pub(crate) syntax: SyntaxNode, | ||
1130 | } | ||
1131 | impl ast::AttrsOwner for UseItem {} | ||
1132 | impl ast::VisibilityOwner for UseItem {} | ||
1133 | impl UseItem { | ||
1134 | pub fn use_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![use]) } | ||
1135 | pub fn use_tree(&self) -> Option<UseTree> { support::child(&self.syntax) } | ||
1136 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
1137 | } | ||
1138 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1139 | pub struct UseTree { | 1162 | pub struct UseTree { |
1140 | pub(crate) syntax: SyntaxNode, | 1163 | pub(crate) syntax: SyntaxNode, |
1141 | } | 1164 | } |
@@ -1164,20 +1187,6 @@ impl Alias { | |||
1164 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | 1187 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } |
1165 | } | 1188 | } |
1166 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1189 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1167 | pub struct ExternCrateItem { | ||
1168 | pub(crate) syntax: SyntaxNode, | ||
1169 | } | ||
1170 | impl ast::AttrsOwner for ExternCrateItem {} | ||
1171 | impl ast::VisibilityOwner for ExternCrateItem {} | ||
1172 | impl ExternCrateItem { | ||
1173 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } | ||
1174 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | ||
1175 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
1176 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
1177 | pub fn alias(&self) -> Option<Alias> { support::child(&self.syntax) } | ||
1178 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
1179 | } | ||
1180 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1181 | pub struct PathSegment { | 1190 | pub struct PathSegment { |
1182 | pub(crate) syntax: SyntaxNode, | 1191 | pub(crate) syntax: SyntaxNode, |
1183 | } | 1192 | } |
@@ -1229,15 +1238,6 @@ impl ConstArg { | |||
1229 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | 1238 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } |
1230 | } | 1239 | } |
1231 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1240 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1232 | pub struct ExternBlock { | ||
1233 | pub(crate) syntax: SyntaxNode, | ||
1234 | } | ||
1235 | impl ast::AttrsOwner for ExternBlock {} | ||
1236 | impl ExternBlock { | ||
1237 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | ||
1238 | pub fn extern_item_list(&self) -> Option<ExternItemList> { support::child(&self.syntax) } | ||
1239 | } | ||
1240 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1241 | pub struct ExternItemList { | 1241 | pub struct ExternItemList { |
1242 | pub(crate) syntax: SyntaxNode, | 1242 | pub(crate) syntax: SyntaxNode, |
1243 | } | 1243 | } |
@@ -1257,23 +1257,23 @@ impl MetaItem { | |||
1257 | pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) } | 1257 | pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) } |
1258 | } | 1258 | } |
1259 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1259 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1260 | pub enum ModuleItem { | 1260 | pub enum Item { |
1261 | StructDef(StructDef), | 1261 | ConstDef(ConstDef), |
1262 | UnionDef(UnionDef), | ||
1263 | EnumDef(EnumDef), | 1262 | EnumDef(EnumDef), |
1263 | ExternBlock(ExternBlock), | ||
1264 | ExternCrateItem(ExternCrateItem), | ||
1264 | FnDef(FnDef), | 1265 | FnDef(FnDef), |
1266 | ImplDef(ImplDef), | ||
1267 | MacroCall(MacroCall), | ||
1268 | Module(Module), | ||
1269 | StaticDef(StaticDef), | ||
1270 | StructDef(StructDef), | ||
1265 | TraitDef(TraitDef), | 1271 | TraitDef(TraitDef), |
1266 | TypeAliasDef(TypeAliasDef), | 1272 | TypeAliasDef(TypeAliasDef), |
1267 | ImplDef(ImplDef), | 1273 | UnionDef(UnionDef), |
1268 | UseItem(UseItem), | 1274 | UseItem(UseItem), |
1269 | ExternCrateItem(ExternCrateItem), | ||
1270 | ConstDef(ConstDef), | ||
1271 | StaticDef(StaticDef), | ||
1272 | Module(Module), | ||
1273 | MacroCall(MacroCall), | ||
1274 | ExternBlock(ExternBlock), | ||
1275 | } | 1275 | } |
1276 | impl ast::AttrsOwner for ModuleItem {} | 1276 | impl ast::AttrsOwner for Item {} |
1277 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1277 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1278 | pub enum TypeRef { | 1278 | pub enum TypeRef { |
1279 | ParenType(ParenType), | 1279 | ParenType(ParenType), |
@@ -1407,8 +1407,8 @@ impl AstNode for Attr { | |||
1407 | } | 1407 | } |
1408 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1408 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1409 | } | 1409 | } |
1410 | impl AstNode for FnDef { | 1410 | impl AstNode for ConstDef { |
1411 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN_DEF } | 1411 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_DEF } |
1412 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1412 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1413 | if Self::can_cast(syntax.kind()) { | 1413 | if Self::can_cast(syntax.kind()) { |
1414 | Some(Self { syntax }) | 1414 | Some(Self { syntax }) |
@@ -1418,8 +1418,8 @@ impl AstNode for FnDef { | |||
1418 | } | 1418 | } |
1419 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1419 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1420 | } | 1420 | } |
1421 | impl AstNode for Visibility { | 1421 | impl AstNode for EnumDef { |
1422 | fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY } | 1422 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_DEF } |
1423 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1423 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1424 | if Self::can_cast(syntax.kind()) { | 1424 | if Self::can_cast(syntax.kind()) { |
1425 | Some(Self { syntax }) | 1425 | Some(Self { syntax }) |
@@ -1429,8 +1429,8 @@ impl AstNode for Visibility { | |||
1429 | } | 1429 | } |
1430 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1430 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1431 | } | 1431 | } |
1432 | impl AstNode for Abi { | 1432 | impl AstNode for ExternBlock { |
1433 | fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } | 1433 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK } |
1434 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1434 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1435 | if Self::can_cast(syntax.kind()) { | 1435 | if Self::can_cast(syntax.kind()) { |
1436 | Some(Self { syntax }) | 1436 | Some(Self { syntax }) |
@@ -1440,8 +1440,8 @@ impl AstNode for Abi { | |||
1440 | } | 1440 | } |
1441 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1441 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1442 | } | 1442 | } |
1443 | impl AstNode for Name { | 1443 | impl AstNode for ExternCrateItem { |
1444 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } | 1444 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE_ITEM } |
1445 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1445 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1446 | if Self::can_cast(syntax.kind()) { | 1446 | if Self::can_cast(syntax.kind()) { |
1447 | Some(Self { syntax }) | 1447 | Some(Self { syntax }) |
@@ -1451,8 +1451,8 @@ impl AstNode for Name { | |||
1451 | } | 1451 | } |
1452 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1452 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1453 | } | 1453 | } |
1454 | impl AstNode for TypeParamList { | 1454 | impl AstNode for FnDef { |
1455 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM_LIST } | 1455 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN_DEF } |
1456 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1456 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1457 | if Self::can_cast(syntax.kind()) { | 1457 | if Self::can_cast(syntax.kind()) { |
1458 | Some(Self { syntax }) | 1458 | Some(Self { syntax }) |
@@ -1462,8 +1462,8 @@ impl AstNode for TypeParamList { | |||
1462 | } | 1462 | } |
1463 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1463 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1464 | } | 1464 | } |
1465 | impl AstNode for ParamList { | 1465 | impl AstNode for ImplDef { |
1466 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } | 1466 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_DEF } |
1467 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1467 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1468 | if Self::can_cast(syntax.kind()) { | 1468 | if Self::can_cast(syntax.kind()) { |
1469 | Some(Self { syntax }) | 1469 | Some(Self { syntax }) |
@@ -1473,8 +1473,8 @@ impl AstNode for ParamList { | |||
1473 | } | 1473 | } |
1474 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1474 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1475 | } | 1475 | } |
1476 | impl AstNode for RetType { | 1476 | impl AstNode for MacroCall { |
1477 | fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE } | 1477 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } |
1478 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1478 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1479 | if Self::can_cast(syntax.kind()) { | 1479 | if Self::can_cast(syntax.kind()) { |
1480 | Some(Self { syntax }) | 1480 | Some(Self { syntax }) |
@@ -1484,8 +1484,8 @@ impl AstNode for RetType { | |||
1484 | } | 1484 | } |
1485 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1485 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1486 | } | 1486 | } |
1487 | impl AstNode for WhereClause { | 1487 | impl AstNode for Module { |
1488 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } | 1488 | fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } |
1489 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1489 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1490 | if Self::can_cast(syntax.kind()) { | 1490 | if Self::can_cast(syntax.kind()) { |
1491 | Some(Self { syntax }) | 1491 | Some(Self { syntax }) |
@@ -1495,8 +1495,8 @@ impl AstNode for WhereClause { | |||
1495 | } | 1495 | } |
1496 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1496 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1497 | } | 1497 | } |
1498 | impl AstNode for BlockExpr { | 1498 | impl AstNode for StaticDef { |
1499 | fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR } | 1499 | fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC_DEF } |
1500 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1500 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1501 | if Self::can_cast(syntax.kind()) { | 1501 | if Self::can_cast(syntax.kind()) { |
1502 | Some(Self { syntax }) | 1502 | Some(Self { syntax }) |
@@ -1517,8 +1517,8 @@ impl AstNode for StructDef { | |||
1517 | } | 1517 | } |
1518 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1518 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1519 | } | 1519 | } |
1520 | impl AstNode for RecordFieldDefList { | 1520 | impl AstNode for TraitDef { |
1521 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST } | 1521 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF } |
1522 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1522 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1523 | if Self::can_cast(syntax.kind()) { | 1523 | if Self::can_cast(syntax.kind()) { |
1524 | Some(Self { syntax }) | 1524 | Some(Self { syntax }) |
@@ -1528,8 +1528,8 @@ impl AstNode for RecordFieldDefList { | |||
1528 | } | 1528 | } |
1529 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1529 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1530 | } | 1530 | } |
1531 | impl AstNode for TupleFieldDefList { | 1531 | impl AstNode for TypeAliasDef { |
1532 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST } | 1532 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS_DEF } |
1533 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1533 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1534 | if Self::can_cast(syntax.kind()) { | 1534 | if Self::can_cast(syntax.kind()) { |
1535 | Some(Self { syntax }) | 1535 | Some(Self { syntax }) |
@@ -1550,8 +1550,8 @@ impl AstNode for UnionDef { | |||
1550 | } | 1550 | } |
1551 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1551 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1552 | } | 1552 | } |
1553 | impl AstNode for RecordFieldDef { | 1553 | impl AstNode for UseItem { |
1554 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF } | 1554 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_ITEM } |
1555 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1555 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1556 | if Self::can_cast(syntax.kind()) { | 1556 | if Self::can_cast(syntax.kind()) { |
1557 | Some(Self { syntax }) | 1557 | Some(Self { syntax }) |
@@ -1561,8 +1561,8 @@ impl AstNode for RecordFieldDef { | |||
1561 | } | 1561 | } |
1562 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1562 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1563 | } | 1563 | } |
1564 | impl AstNode for TupleFieldDef { | 1564 | impl AstNode for Visibility { |
1565 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF } | 1565 | fn can_cast(kind: SyntaxKind) -> bool { kind == VISIBILITY } |
1566 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1566 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1567 | if Self::can_cast(syntax.kind()) { | 1567 | if Self::can_cast(syntax.kind()) { |
1568 | Some(Self { syntax }) | 1568 | Some(Self { syntax }) |
@@ -1572,8 +1572,8 @@ impl AstNode for TupleFieldDef { | |||
1572 | } | 1572 | } |
1573 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1573 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1574 | } | 1574 | } |
1575 | impl AstNode for EnumDef { | 1575 | impl AstNode for Abi { |
1576 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_DEF } | 1576 | fn can_cast(kind: SyntaxKind) -> bool { kind == ABI } |
1577 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1577 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1578 | if Self::can_cast(syntax.kind()) { | 1578 | if Self::can_cast(syntax.kind()) { |
1579 | Some(Self { syntax }) | 1579 | Some(Self { syntax }) |
@@ -1583,8 +1583,8 @@ impl AstNode for EnumDef { | |||
1583 | } | 1583 | } |
1584 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1584 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1585 | } | 1585 | } |
1586 | impl AstNode for EnumVariantList { | 1586 | impl AstNode for Name { |
1587 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST } | 1587 | fn can_cast(kind: SyntaxKind) -> bool { kind == NAME } |
1588 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1588 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1589 | if Self::can_cast(syntax.kind()) { | 1589 | if Self::can_cast(syntax.kind()) { |
1590 | Some(Self { syntax }) | 1590 | Some(Self { syntax }) |
@@ -1594,8 +1594,8 @@ impl AstNode for EnumVariantList { | |||
1594 | } | 1594 | } |
1595 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1595 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1596 | } | 1596 | } |
1597 | impl AstNode for EnumVariant { | 1597 | impl AstNode for TypeParamList { |
1598 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT } | 1598 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM_LIST } |
1599 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1599 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1600 | if Self::can_cast(syntax.kind()) { | 1600 | if Self::can_cast(syntax.kind()) { |
1601 | Some(Self { syntax }) | 1601 | Some(Self { syntax }) |
@@ -1605,8 +1605,8 @@ impl AstNode for EnumVariant { | |||
1605 | } | 1605 | } |
1606 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1606 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1607 | } | 1607 | } |
1608 | impl AstNode for TraitDef { | 1608 | impl AstNode for ParamList { |
1609 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF } | 1609 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } |
1610 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1610 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1611 | if Self::can_cast(syntax.kind()) { | 1611 | if Self::can_cast(syntax.kind()) { |
1612 | Some(Self { syntax }) | 1612 | Some(Self { syntax }) |
@@ -1616,8 +1616,8 @@ impl AstNode for TraitDef { | |||
1616 | } | 1616 | } |
1617 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1617 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1618 | } | 1618 | } |
1619 | impl AstNode for TypeBoundList { | 1619 | impl AstNode for RetType { |
1620 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } | 1620 | fn can_cast(kind: SyntaxKind) -> bool { kind == RET_TYPE } |
1621 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1621 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1622 | if Self::can_cast(syntax.kind()) { | 1622 | if Self::can_cast(syntax.kind()) { |
1623 | Some(Self { syntax }) | 1623 | Some(Self { syntax }) |
@@ -1627,8 +1627,8 @@ impl AstNode for TypeBoundList { | |||
1627 | } | 1627 | } |
1628 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1628 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1629 | } | 1629 | } |
1630 | impl AstNode for ItemList { | 1630 | impl AstNode for WhereClause { |
1631 | fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } | 1631 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHERE_CLAUSE } |
1632 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1632 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1633 | if Self::can_cast(syntax.kind()) { | 1633 | if Self::can_cast(syntax.kind()) { |
1634 | Some(Self { syntax }) | 1634 | Some(Self { syntax }) |
@@ -1638,8 +1638,8 @@ impl AstNode for ItemList { | |||
1638 | } | 1638 | } |
1639 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1639 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1640 | } | 1640 | } |
1641 | impl AstNode for Module { | 1641 | impl AstNode for BlockExpr { |
1642 | fn can_cast(kind: SyntaxKind) -> bool { kind == MODULE } | 1642 | fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK_EXPR } |
1643 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1643 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1644 | if Self::can_cast(syntax.kind()) { | 1644 | if Self::can_cast(syntax.kind()) { |
1645 | Some(Self { syntax }) | 1645 | Some(Self { syntax }) |
@@ -1649,8 +1649,8 @@ impl AstNode for Module { | |||
1649 | } | 1649 | } |
1650 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1650 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1651 | } | 1651 | } |
1652 | impl AstNode for ConstDef { | 1652 | impl AstNode for RecordFieldDefList { |
1653 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_DEF } | 1653 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST } |
1654 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1654 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1655 | if Self::can_cast(syntax.kind()) { | 1655 | if Self::can_cast(syntax.kind()) { |
1656 | Some(Self { syntax }) | 1656 | Some(Self { syntax }) |
@@ -1660,8 +1660,8 @@ impl AstNode for ConstDef { | |||
1660 | } | 1660 | } |
1661 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1661 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1662 | } | 1662 | } |
1663 | impl AstNode for StaticDef { | 1663 | impl AstNode for TupleFieldDefList { |
1664 | fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC_DEF } | 1664 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST } |
1665 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1665 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1666 | if Self::can_cast(syntax.kind()) { | 1666 | if Self::can_cast(syntax.kind()) { |
1667 | Some(Self { syntax }) | 1667 | Some(Self { syntax }) |
@@ -1671,8 +1671,8 @@ impl AstNode for StaticDef { | |||
1671 | } | 1671 | } |
1672 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1672 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1673 | } | 1673 | } |
1674 | impl AstNode for TypeAliasDef { | 1674 | impl AstNode for RecordFieldDef { |
1675 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS_DEF } | 1675 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF } |
1676 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1676 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1677 | if Self::can_cast(syntax.kind()) { | 1677 | if Self::can_cast(syntax.kind()) { |
1678 | Some(Self { syntax }) | 1678 | Some(Self { syntax }) |
@@ -1682,8 +1682,52 @@ impl AstNode for TypeAliasDef { | |||
1682 | } | 1682 | } |
1683 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1683 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1684 | } | 1684 | } |
1685 | impl AstNode for ImplDef { | 1685 | impl AstNode for TupleFieldDef { |
1686 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_DEF } | 1686 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF } |
1687 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1688 | if Self::can_cast(syntax.kind()) { | ||
1689 | Some(Self { syntax }) | ||
1690 | } else { | ||
1691 | None | ||
1692 | } | ||
1693 | } | ||
1694 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1695 | } | ||
1696 | impl AstNode for EnumVariantList { | ||
1697 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST } | ||
1698 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1699 | if Self::can_cast(syntax.kind()) { | ||
1700 | Some(Self { syntax }) | ||
1701 | } else { | ||
1702 | None | ||
1703 | } | ||
1704 | } | ||
1705 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1706 | } | ||
1707 | impl AstNode for EnumVariant { | ||
1708 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT } | ||
1709 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1710 | if Self::can_cast(syntax.kind()) { | ||
1711 | Some(Self { syntax }) | ||
1712 | } else { | ||
1713 | None | ||
1714 | } | ||
1715 | } | ||
1716 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1717 | } | ||
1718 | impl AstNode for TypeBoundList { | ||
1719 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } | ||
1720 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1721 | if Self::can_cast(syntax.kind()) { | ||
1722 | Some(Self { syntax }) | ||
1723 | } else { | ||
1724 | None | ||
1725 | } | ||
1726 | } | ||
1727 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1728 | } | ||
1729 | impl AstNode for ItemList { | ||
1730 | fn can_cast(kind: SyntaxKind) -> bool { kind == ITEM_LIST } | ||
1687 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1731 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1688 | if Self::can_cast(syntax.kind()) { | 1732 | if Self::can_cast(syntax.kind()) { |
1689 | Some(Self { syntax }) | 1733 | Some(Self { syntax }) |
@@ -2397,17 +2441,6 @@ impl AstNode for MacroPat { | |||
2397 | } | 2441 | } |
2398 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2442 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2399 | } | 2443 | } |
2400 | impl AstNode for MacroCall { | ||
2401 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_CALL } | ||
2402 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2403 | if Self::can_cast(syntax.kind()) { | ||
2404 | Some(Self { syntax }) | ||
2405 | } else { | ||
2406 | None | ||
2407 | } | ||
2408 | } | ||
2409 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2410 | } | ||
2411 | impl AstNode for RecordPat { | 2444 | impl AstNode for RecordPat { |
2412 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT } | 2445 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_PAT } |
2413 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2446 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2606,17 +2639,6 @@ impl AstNode for Param { | |||
2606 | } | 2639 | } |
2607 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2640 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2608 | } | 2641 | } |
2609 | impl AstNode for UseItem { | ||
2610 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_ITEM } | ||
2611 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2612 | if Self::can_cast(syntax.kind()) { | ||
2613 | Some(Self { syntax }) | ||
2614 | } else { | ||
2615 | None | ||
2616 | } | ||
2617 | } | ||
2618 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2619 | } | ||
2620 | impl AstNode for UseTree { | 2642 | impl AstNode for UseTree { |
2621 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } | 2643 | fn can_cast(kind: SyntaxKind) -> bool { kind == USE_TREE } |
2622 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2644 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2650,17 +2672,6 @@ impl AstNode for Alias { | |||
2650 | } | 2672 | } |
2651 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2673 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2652 | } | 2674 | } |
2653 | impl AstNode for ExternCrateItem { | ||
2654 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_CRATE_ITEM } | ||
2655 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2656 | if Self::can_cast(syntax.kind()) { | ||
2657 | Some(Self { syntax }) | ||
2658 | } else { | ||
2659 | None | ||
2660 | } | ||
2661 | } | ||
2662 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2663 | } | ||
2664 | impl AstNode for PathSegment { | 2675 | impl AstNode for PathSegment { |
2665 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } | 2676 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } |
2666 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2677 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2716,17 +2727,6 @@ impl AstNode for ConstArg { | |||
2716 | } | 2727 | } |
2717 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2728 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2718 | } | 2729 | } |
2719 | impl AstNode for ExternBlock { | ||
2720 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_BLOCK } | ||
2721 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2722 | if Self::can_cast(syntax.kind()) { | ||
2723 | Some(Self { syntax }) | ||
2724 | } else { | ||
2725 | None | ||
2726 | } | ||
2727 | } | ||
2728 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2729 | } | ||
2730 | impl AstNode for ExternItemList { | 2730 | impl AstNode for ExternItemList { |
2731 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } | 2731 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } |
2732 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2732 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2749,93 +2749,93 @@ impl AstNode for MetaItem { | |||
2749 | } | 2749 | } |
2750 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2750 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2751 | } | 2751 | } |
2752 | impl From<StructDef> for ModuleItem { | 2752 | impl From<ConstDef> for Item { |
2753 | fn from(node: StructDef) -> ModuleItem { ModuleItem::StructDef(node) } | 2753 | fn from(node: ConstDef) -> Item { Item::ConstDef(node) } |
2754 | } | 2754 | } |
2755 | impl From<UnionDef> for ModuleItem { | 2755 | impl From<EnumDef> for Item { |
2756 | fn from(node: UnionDef) -> ModuleItem { ModuleItem::UnionDef(node) } | 2756 | fn from(node: EnumDef) -> Item { Item::EnumDef(node) } |
2757 | } | 2757 | } |
2758 | impl From<EnumDef> for ModuleItem { | 2758 | impl From<ExternBlock> for Item { |
2759 | fn from(node: EnumDef) -> ModuleItem { ModuleItem::EnumDef(node) } | 2759 | fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) } |
2760 | } | 2760 | } |
2761 | impl From<FnDef> for ModuleItem { | 2761 | impl From<ExternCrateItem> for Item { |
2762 | fn from(node: FnDef) -> ModuleItem { ModuleItem::FnDef(node) } | 2762 | fn from(node: ExternCrateItem) -> Item { Item::ExternCrateItem(node) } |
2763 | } | 2763 | } |
2764 | impl From<TraitDef> for ModuleItem { | 2764 | impl From<FnDef> for Item { |
2765 | fn from(node: TraitDef) -> ModuleItem { ModuleItem::TraitDef(node) } | 2765 | fn from(node: FnDef) -> Item { Item::FnDef(node) } |
2766 | } | 2766 | } |
2767 | impl From<TypeAliasDef> for ModuleItem { | 2767 | impl From<ImplDef> for Item { |
2768 | fn from(node: TypeAliasDef) -> ModuleItem { ModuleItem::TypeAliasDef(node) } | 2768 | fn from(node: ImplDef) -> Item { Item::ImplDef(node) } |
2769 | } | 2769 | } |
2770 | impl From<ImplDef> for ModuleItem { | 2770 | impl From<MacroCall> for Item { |
2771 | fn from(node: ImplDef) -> ModuleItem { ModuleItem::ImplDef(node) } | 2771 | fn from(node: MacroCall) -> Item { Item::MacroCall(node) } |
2772 | } | 2772 | } |
2773 | impl From<UseItem> for ModuleItem { | 2773 | impl From<Module> for Item { |
2774 | fn from(node: UseItem) -> ModuleItem { ModuleItem::UseItem(node) } | 2774 | fn from(node: Module) -> Item { Item::Module(node) } |
2775 | } | 2775 | } |
2776 | impl From<ExternCrateItem> for ModuleItem { | 2776 | impl From<StaticDef> for Item { |
2777 | fn from(node: ExternCrateItem) -> ModuleItem { ModuleItem::ExternCrateItem(node) } | 2777 | fn from(node: StaticDef) -> Item { Item::StaticDef(node) } |
2778 | } | 2778 | } |
2779 | impl From<ConstDef> for ModuleItem { | 2779 | impl From<StructDef> for Item { |
2780 | fn from(node: ConstDef) -> ModuleItem { ModuleItem::ConstDef(node) } | 2780 | fn from(node: StructDef) -> Item { Item::StructDef(node) } |
2781 | } | 2781 | } |
2782 | impl From<StaticDef> for ModuleItem { | 2782 | impl From<TraitDef> for Item { |
2783 | fn from(node: StaticDef) -> ModuleItem { ModuleItem::StaticDef(node) } | 2783 | fn from(node: TraitDef) -> Item { Item::TraitDef(node) } |
2784 | } | 2784 | } |
2785 | impl From<Module> for ModuleItem { | 2785 | impl From<TypeAliasDef> for Item { |
2786 | fn from(node: Module) -> ModuleItem { ModuleItem::Module(node) } | 2786 | fn from(node: TypeAliasDef) -> Item { Item::TypeAliasDef(node) } |
2787 | } | 2787 | } |
2788 | impl From<MacroCall> for ModuleItem { | 2788 | impl From<UnionDef> for Item { |
2789 | fn from(node: MacroCall) -> ModuleItem { ModuleItem::MacroCall(node) } | 2789 | fn from(node: UnionDef) -> Item { Item::UnionDef(node) } |
2790 | } | 2790 | } |
2791 | impl From<ExternBlock> for ModuleItem { | 2791 | impl From<UseItem> for Item { |
2792 | fn from(node: ExternBlock) -> ModuleItem { ModuleItem::ExternBlock(node) } | 2792 | fn from(node: UseItem) -> Item { Item::UseItem(node) } |
2793 | } | 2793 | } |
2794 | impl AstNode for ModuleItem { | 2794 | impl AstNode for Item { |
2795 | fn can_cast(kind: SyntaxKind) -> bool { | 2795 | fn can_cast(kind: SyntaxKind) -> bool { |
2796 | match kind { | 2796 | match kind { |
2797 | STRUCT_DEF | UNION_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | IMPL_DEF | 2797 | CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE_ITEM | FN_DEF | IMPL_DEF |
2798 | | USE_ITEM | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE | MACRO_CALL | 2798 | | MACRO_CALL | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS_DEF |
2799 | | EXTERN_BLOCK => true, | 2799 | | UNION_DEF | USE_ITEM => true, |
2800 | _ => false, | 2800 | _ => false, |
2801 | } | 2801 | } |
2802 | } | 2802 | } |
2803 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2803 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2804 | let res = match syntax.kind() { | 2804 | let res = match syntax.kind() { |
2805 | STRUCT_DEF => ModuleItem::StructDef(StructDef { syntax }), | 2805 | CONST_DEF => Item::ConstDef(ConstDef { syntax }), |
2806 | UNION_DEF => ModuleItem::UnionDef(UnionDef { syntax }), | 2806 | ENUM_DEF => Item::EnumDef(EnumDef { syntax }), |
2807 | ENUM_DEF => ModuleItem::EnumDef(EnumDef { syntax }), | 2807 | EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }), |
2808 | FN_DEF => ModuleItem::FnDef(FnDef { syntax }), | 2808 | EXTERN_CRATE_ITEM => Item::ExternCrateItem(ExternCrateItem { syntax }), |
2809 | TRAIT_DEF => ModuleItem::TraitDef(TraitDef { syntax }), | 2809 | FN_DEF => Item::FnDef(FnDef { syntax }), |
2810 | TYPE_ALIAS_DEF => ModuleItem::TypeAliasDef(TypeAliasDef { syntax }), | 2810 | IMPL_DEF => Item::ImplDef(ImplDef { syntax }), |
2811 | IMPL_DEF => ModuleItem::ImplDef(ImplDef { syntax }), | 2811 | MACRO_CALL => Item::MacroCall(MacroCall { syntax }), |
2812 | USE_ITEM => ModuleItem::UseItem(UseItem { syntax }), | 2812 | MODULE => Item::Module(Module { syntax }), |
2813 | EXTERN_CRATE_ITEM => ModuleItem::ExternCrateItem(ExternCrateItem { syntax }), | 2813 | STATIC_DEF => Item::StaticDef(StaticDef { syntax }), |
2814 | CONST_DEF => ModuleItem::ConstDef(ConstDef { syntax }), | 2814 | STRUCT_DEF => Item::StructDef(StructDef { syntax }), |
2815 | STATIC_DEF => ModuleItem::StaticDef(StaticDef { syntax }), | 2815 | TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), |
2816 | MODULE => ModuleItem::Module(Module { syntax }), | 2816 | TYPE_ALIAS_DEF => Item::TypeAliasDef(TypeAliasDef { syntax }), |
2817 | MACRO_CALL => ModuleItem::MacroCall(MacroCall { syntax }), | 2817 | UNION_DEF => Item::UnionDef(UnionDef { syntax }), |
2818 | EXTERN_BLOCK => ModuleItem::ExternBlock(ExternBlock { syntax }), | 2818 | USE_ITEM => Item::UseItem(UseItem { syntax }), |
2819 | _ => return None, | 2819 | _ => return None, |
2820 | }; | 2820 | }; |
2821 | Some(res) | 2821 | Some(res) |
2822 | } | 2822 | } |
2823 | fn syntax(&self) -> &SyntaxNode { | 2823 | fn syntax(&self) -> &SyntaxNode { |
2824 | match self { | 2824 | match self { |
2825 | ModuleItem::StructDef(it) => &it.syntax, | 2825 | Item::ConstDef(it) => &it.syntax, |
2826 | ModuleItem::UnionDef(it) => &it.syntax, | 2826 | Item::EnumDef(it) => &it.syntax, |
2827 | ModuleItem::EnumDef(it) => &it.syntax, | 2827 | Item::ExternBlock(it) => &it.syntax, |
2828 | ModuleItem::FnDef(it) => &it.syntax, | 2828 | Item::ExternCrateItem(it) => &it.syntax, |
2829 | ModuleItem::TraitDef(it) => &it.syntax, | 2829 | Item::FnDef(it) => &it.syntax, |
2830 | ModuleItem::TypeAliasDef(it) => &it.syntax, | 2830 | Item::ImplDef(it) => &it.syntax, |
2831 | ModuleItem::ImplDef(it) => &it.syntax, | 2831 | Item::MacroCall(it) => &it.syntax, |
2832 | ModuleItem::UseItem(it) => &it.syntax, | 2832 | Item::Module(it) => &it.syntax, |
2833 | ModuleItem::ExternCrateItem(it) => &it.syntax, | 2833 | Item::StaticDef(it) => &it.syntax, |
2834 | ModuleItem::ConstDef(it) => &it.syntax, | 2834 | Item::StructDef(it) => &it.syntax, |
2835 | ModuleItem::StaticDef(it) => &it.syntax, | 2835 | Item::TraitDef(it) => &it.syntax, |
2836 | ModuleItem::Module(it) => &it.syntax, | 2836 | Item::TypeAliasDef(it) => &it.syntax, |
2837 | ModuleItem::MacroCall(it) => &it.syntax, | 2837 | Item::UnionDef(it) => &it.syntax, |
2838 | ModuleItem::ExternBlock(it) => &it.syntax, | 2838 | Item::UseItem(it) => &it.syntax, |
2839 | } | 2839 | } |
2840 | } | 2840 | } |
2841 | } | 2841 | } |
@@ -3378,7 +3378,7 @@ impl AstNode for AdtDef { | |||
3378 | } | 3378 | } |
3379 | } | 3379 | } |
3380 | } | 3380 | } |
3381 | impl std::fmt::Display for ModuleItem { | 3381 | impl std::fmt::Display for Item { |
3382 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3382 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3383 | std::fmt::Display::fmt(self.syntax(), f) | 3383 | std::fmt::Display::fmt(self.syntax(), f) |
3384 | } | 3384 | } |
@@ -3438,47 +3438,47 @@ impl std::fmt::Display for Attr { | |||
3438 | std::fmt::Display::fmt(self.syntax(), f) | 3438 | std::fmt::Display::fmt(self.syntax(), f) |
3439 | } | 3439 | } |
3440 | } | 3440 | } |
3441 | impl std::fmt::Display for FnDef { | 3441 | impl std::fmt::Display for ConstDef { |
3442 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3442 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3443 | std::fmt::Display::fmt(self.syntax(), f) | 3443 | std::fmt::Display::fmt(self.syntax(), f) |
3444 | } | 3444 | } |
3445 | } | 3445 | } |
3446 | impl std::fmt::Display for Visibility { | 3446 | impl std::fmt::Display for EnumDef { |
3447 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3447 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3448 | std::fmt::Display::fmt(self.syntax(), f) | 3448 | std::fmt::Display::fmt(self.syntax(), f) |
3449 | } | 3449 | } |
3450 | } | 3450 | } |
3451 | impl std::fmt::Display for Abi { | 3451 | impl std::fmt::Display for ExternBlock { |
3452 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3452 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3453 | std::fmt::Display::fmt(self.syntax(), f) | 3453 | std::fmt::Display::fmt(self.syntax(), f) |
3454 | } | 3454 | } |
3455 | } | 3455 | } |
3456 | impl std::fmt::Display for Name { | 3456 | impl std::fmt::Display for ExternCrateItem { |
3457 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3457 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3458 | std::fmt::Display::fmt(self.syntax(), f) | 3458 | std::fmt::Display::fmt(self.syntax(), f) |
3459 | } | 3459 | } |
3460 | } | 3460 | } |
3461 | impl std::fmt::Display for TypeParamList { | 3461 | impl std::fmt::Display for FnDef { |
3462 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3462 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3463 | std::fmt::Display::fmt(self.syntax(), f) | 3463 | std::fmt::Display::fmt(self.syntax(), f) |
3464 | } | 3464 | } |
3465 | } | 3465 | } |
3466 | impl std::fmt::Display for ParamList { | 3466 | impl std::fmt::Display for ImplDef { |
3467 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3467 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3468 | std::fmt::Display::fmt(self.syntax(), f) | 3468 | std::fmt::Display::fmt(self.syntax(), f) |
3469 | } | 3469 | } |
3470 | } | 3470 | } |
3471 | impl std::fmt::Display for RetType { | 3471 | impl std::fmt::Display for MacroCall { |
3472 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3472 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3473 | std::fmt::Display::fmt(self.syntax(), f) | 3473 | std::fmt::Display::fmt(self.syntax(), f) |
3474 | } | 3474 | } |
3475 | } | 3475 | } |
3476 | impl std::fmt::Display for WhereClause { | 3476 | impl std::fmt::Display for Module { |
3477 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3477 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3478 | std::fmt::Display::fmt(self.syntax(), f) | 3478 | std::fmt::Display::fmt(self.syntax(), f) |
3479 | } | 3479 | } |
3480 | } | 3480 | } |
3481 | impl std::fmt::Display for BlockExpr { | 3481 | impl std::fmt::Display for StaticDef { |
3482 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3482 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3483 | std::fmt::Display::fmt(self.syntax(), f) | 3483 | std::fmt::Display::fmt(self.syntax(), f) |
3484 | } | 3484 | } |
@@ -3488,12 +3488,12 @@ impl std::fmt::Display for StructDef { | |||
3488 | std::fmt::Display::fmt(self.syntax(), f) | 3488 | std::fmt::Display::fmt(self.syntax(), f) |
3489 | } | 3489 | } |
3490 | } | 3490 | } |
3491 | impl std::fmt::Display for RecordFieldDefList { | 3491 | impl std::fmt::Display for TraitDef { |
3492 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3492 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3493 | std::fmt::Display::fmt(self.syntax(), f) | 3493 | std::fmt::Display::fmt(self.syntax(), f) |
3494 | } | 3494 | } |
3495 | } | 3495 | } |
3496 | impl std::fmt::Display for TupleFieldDefList { | 3496 | impl std::fmt::Display for TypeAliasDef { |
3497 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3497 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3498 | std::fmt::Display::fmt(self.syntax(), f) | 3498 | std::fmt::Display::fmt(self.syntax(), f) |
3499 | } | 3499 | } |
@@ -3503,67 +3503,87 @@ impl std::fmt::Display for UnionDef { | |||
3503 | std::fmt::Display::fmt(self.syntax(), f) | 3503 | std::fmt::Display::fmt(self.syntax(), f) |
3504 | } | 3504 | } |
3505 | } | 3505 | } |
3506 | impl std::fmt::Display for RecordFieldDef { | 3506 | impl std::fmt::Display for UseItem { |
3507 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3507 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3508 | std::fmt::Display::fmt(self.syntax(), f) | 3508 | std::fmt::Display::fmt(self.syntax(), f) |
3509 | } | 3509 | } |
3510 | } | 3510 | } |
3511 | impl std::fmt::Display for TupleFieldDef { | 3511 | impl std::fmt::Display for Visibility { |
3512 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3512 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3513 | std::fmt::Display::fmt(self.syntax(), f) | 3513 | std::fmt::Display::fmt(self.syntax(), f) |
3514 | } | 3514 | } |
3515 | } | 3515 | } |
3516 | impl std::fmt::Display for EnumDef { | 3516 | impl std::fmt::Display for Abi { |
3517 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3517 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3518 | std::fmt::Display::fmt(self.syntax(), f) | 3518 | std::fmt::Display::fmt(self.syntax(), f) |
3519 | } | 3519 | } |
3520 | } | 3520 | } |
3521 | impl std::fmt::Display for EnumVariantList { | 3521 | impl std::fmt::Display for Name { |
3522 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3522 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3523 | std::fmt::Display::fmt(self.syntax(), f) | 3523 | std::fmt::Display::fmt(self.syntax(), f) |
3524 | } | 3524 | } |
3525 | } | 3525 | } |
3526 | impl std::fmt::Display for EnumVariant { | 3526 | impl std::fmt::Display for TypeParamList { |
3527 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3527 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3528 | std::fmt::Display::fmt(self.syntax(), f) | 3528 | std::fmt::Display::fmt(self.syntax(), f) |
3529 | } | 3529 | } |
3530 | } | 3530 | } |
3531 | impl std::fmt::Display for TraitDef { | 3531 | impl std::fmt::Display for ParamList { |
3532 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3532 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3533 | std::fmt::Display::fmt(self.syntax(), f) | 3533 | std::fmt::Display::fmt(self.syntax(), f) |
3534 | } | 3534 | } |
3535 | } | 3535 | } |
3536 | impl std::fmt::Display for TypeBoundList { | 3536 | impl std::fmt::Display for RetType { |
3537 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3537 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3538 | std::fmt::Display::fmt(self.syntax(), f) | 3538 | std::fmt::Display::fmt(self.syntax(), f) |
3539 | } | 3539 | } |
3540 | } | 3540 | } |
3541 | impl std::fmt::Display for ItemList { | 3541 | impl std::fmt::Display for WhereClause { |
3542 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3542 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3543 | std::fmt::Display::fmt(self.syntax(), f) | 3543 | std::fmt::Display::fmt(self.syntax(), f) |
3544 | } | 3544 | } |
3545 | } | 3545 | } |
3546 | impl std::fmt::Display for Module { | 3546 | impl std::fmt::Display for BlockExpr { |
3547 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3547 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3548 | std::fmt::Display::fmt(self.syntax(), f) | 3548 | std::fmt::Display::fmt(self.syntax(), f) |
3549 | } | 3549 | } |
3550 | } | 3550 | } |
3551 | impl std::fmt::Display for ConstDef { | 3551 | impl std::fmt::Display for RecordFieldDefList { |
3552 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3552 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3553 | std::fmt::Display::fmt(self.syntax(), f) | 3553 | std::fmt::Display::fmt(self.syntax(), f) |
3554 | } | 3554 | } |
3555 | } | 3555 | } |
3556 | impl std::fmt::Display for StaticDef { | 3556 | impl std::fmt::Display for TupleFieldDefList { |
3557 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3557 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3558 | std::fmt::Display::fmt(self.syntax(), f) | 3558 | std::fmt::Display::fmt(self.syntax(), f) |
3559 | } | 3559 | } |
3560 | } | 3560 | } |
3561 | impl std::fmt::Display for TypeAliasDef { | 3561 | impl std::fmt::Display for RecordFieldDef { |
3562 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3562 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3563 | std::fmt::Display::fmt(self.syntax(), f) | 3563 | std::fmt::Display::fmt(self.syntax(), f) |
3564 | } | 3564 | } |
3565 | } | 3565 | } |
3566 | impl std::fmt::Display for ImplDef { | 3566 | impl std::fmt::Display for TupleFieldDef { |
3567 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3568 | std::fmt::Display::fmt(self.syntax(), f) | ||
3569 | } | ||
3570 | } | ||
3571 | impl std::fmt::Display for EnumVariantList { | ||
3572 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3573 | std::fmt::Display::fmt(self.syntax(), f) | ||
3574 | } | ||
3575 | } | ||
3576 | impl std::fmt::Display for EnumVariant { | ||
3577 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3578 | std::fmt::Display::fmt(self.syntax(), f) | ||
3579 | } | ||
3580 | } | ||
3581 | impl std::fmt::Display for TypeBoundList { | ||
3582 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3583 | std::fmt::Display::fmt(self.syntax(), f) | ||
3584 | } | ||
3585 | } | ||
3586 | impl std::fmt::Display for ItemList { | ||
3567 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3587 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3568 | std::fmt::Display::fmt(self.syntax(), f) | 3588 | std::fmt::Display::fmt(self.syntax(), f) |
3569 | } | 3589 | } |
@@ -3888,11 +3908,6 @@ impl std::fmt::Display for MacroPat { | |||
3888 | std::fmt::Display::fmt(self.syntax(), f) | 3908 | std::fmt::Display::fmt(self.syntax(), f) |
3889 | } | 3909 | } |
3890 | } | 3910 | } |
3891 | impl std::fmt::Display for MacroCall { | ||
3892 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3893 | std::fmt::Display::fmt(self.syntax(), f) | ||
3894 | } | ||
3895 | } | ||
3896 | impl std::fmt::Display for RecordPat { | 3911 | impl std::fmt::Display for RecordPat { |
3897 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3912 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3898 | std::fmt::Display::fmt(self.syntax(), f) | 3913 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3983,11 +3998,6 @@ impl std::fmt::Display for Param { | |||
3983 | std::fmt::Display::fmt(self.syntax(), f) | 3998 | std::fmt::Display::fmt(self.syntax(), f) |
3984 | } | 3999 | } |
3985 | } | 4000 | } |
3986 | impl std::fmt::Display for UseItem { | ||
3987 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3988 | std::fmt::Display::fmt(self.syntax(), f) | ||
3989 | } | ||
3990 | } | ||
3991 | impl std::fmt::Display for UseTree { | 4001 | impl std::fmt::Display for UseTree { |
3992 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4002 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3993 | std::fmt::Display::fmt(self.syntax(), f) | 4003 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -4003,11 +4013,6 @@ impl std::fmt::Display for Alias { | |||
4003 | std::fmt::Display::fmt(self.syntax(), f) | 4013 | std::fmt::Display::fmt(self.syntax(), f) |
4004 | } | 4014 | } |
4005 | } | 4015 | } |
4006 | impl std::fmt::Display for ExternCrateItem { | ||
4007 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4008 | std::fmt::Display::fmt(self.syntax(), f) | ||
4009 | } | ||
4010 | } | ||
4011 | impl std::fmt::Display for PathSegment { | 4016 | impl std::fmt::Display for PathSegment { |
4012 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4017 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4013 | std::fmt::Display::fmt(self.syntax(), f) | 4018 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -4033,11 +4038,6 @@ impl std::fmt::Display for ConstArg { | |||
4033 | std::fmt::Display::fmt(self.syntax(), f) | 4038 | std::fmt::Display::fmt(self.syntax(), f) |
4034 | } | 4039 | } |
4035 | } | 4040 | } |
4036 | impl std::fmt::Display for ExternBlock { | ||
4037 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4038 | std::fmt::Display::fmt(self.syntax(), f) | ||
4039 | } | ||
4040 | } | ||
4041 | impl std::fmt::Display for ExternItemList { | 4041 | impl std::fmt::Display for ExternItemList { |
4042 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4042 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4043 | std::fmt::Display::fmt(self.syntax(), f) | 4043 | std::fmt::Display::fmt(self.syntax(), f) |