diff options
Diffstat (limited to 'crates/libsyntax2/src/ast/generated.rs')
-rw-r--r-- | crates/libsyntax2/src/ast/generated.rs | 292 |
1 files changed, 292 insertions, 0 deletions
diff --git a/crates/libsyntax2/src/ast/generated.rs b/crates/libsyntax2/src/ast/generated.rs index 13668b803..3e6c673ab 100644 --- a/crates/libsyntax2/src/ast/generated.rs +++ b/crates/libsyntax2/src/ast/generated.rs | |||
@@ -5,6 +5,24 @@ use { | |||
5 | SyntaxKind::*, | 5 | SyntaxKind::*, |
6 | }; | 6 | }; |
7 | 7 | ||
8 | // ArrayType | ||
9 | #[derive(Debug, Clone, Copy)] | ||
10 | pub struct ArrayType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
11 | syntax: SyntaxNode<R>, | ||
12 | } | ||
13 | |||
14 | impl<R: TreeRoot> AstNode<R> for ArrayType<R> { | ||
15 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
16 | match syntax.kind() { | ||
17 | ARRAY_TYPE => Some(ArrayType { syntax }), | ||
18 | _ => None, | ||
19 | } | ||
20 | } | ||
21 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
22 | } | ||
23 | |||
24 | impl<R: TreeRoot> ArrayType<R> {} | ||
25 | |||
8 | // ConstDef | 26 | // ConstDef |
9 | #[derive(Debug, Clone, Copy)] | 27 | #[derive(Debug, Clone, Copy)] |
10 | pub struct ConstDef<R: TreeRoot = Arc<SyntaxRoot>> { | 28 | pub struct ConstDef<R: TreeRoot = Arc<SyntaxRoot>> { |
@@ -24,6 +42,24 @@ impl<R: TreeRoot> AstNode<R> for ConstDef<R> { | |||
24 | impl<R: TreeRoot> ast::NameOwner<R> for ConstDef<R> {} | 42 | impl<R: TreeRoot> ast::NameOwner<R> for ConstDef<R> {} |
25 | impl<R: TreeRoot> ConstDef<R> {} | 43 | impl<R: TreeRoot> ConstDef<R> {} |
26 | 44 | ||
45 | // DynTraitType | ||
46 | #[derive(Debug, Clone, Copy)] | ||
47 | pub struct DynTraitType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
48 | syntax: SyntaxNode<R>, | ||
49 | } | ||
50 | |||
51 | impl<R: TreeRoot> AstNode<R> for DynTraitType<R> { | ||
52 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
53 | match syntax.kind() { | ||
54 | DYN_TRAIT_TYPE => Some(DynTraitType { syntax }), | ||
55 | _ => None, | ||
56 | } | ||
57 | } | ||
58 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
59 | } | ||
60 | |||
61 | impl<R: TreeRoot> DynTraitType<R> {} | ||
62 | |||
27 | // EnumDef | 63 | // EnumDef |
28 | #[derive(Debug, Clone, Copy)] | 64 | #[derive(Debug, Clone, Copy)] |
29 | pub struct EnumDef<R: TreeRoot = Arc<SyntaxRoot>> { | 65 | pub struct EnumDef<R: TreeRoot = Arc<SyntaxRoot>> { |
@@ -86,6 +122,42 @@ impl<R: TreeRoot> AstNode<R> for FnDef<R> { | |||
86 | impl<R: TreeRoot> ast::NameOwner<R> for FnDef<R> {} | 122 | impl<R: TreeRoot> ast::NameOwner<R> for FnDef<R> {} |
87 | impl<R: TreeRoot> FnDef<R> {} | 123 | impl<R: TreeRoot> FnDef<R> {} |
88 | 124 | ||
125 | // FnPointerType | ||
126 | #[derive(Debug, Clone, Copy)] | ||
127 | pub struct FnPointerType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
128 | syntax: SyntaxNode<R>, | ||
129 | } | ||
130 | |||
131 | impl<R: TreeRoot> AstNode<R> for FnPointerType<R> { | ||
132 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
133 | match syntax.kind() { | ||
134 | FN_POINTER_TYPE => Some(FnPointerType { syntax }), | ||
135 | _ => None, | ||
136 | } | ||
137 | } | ||
138 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
139 | } | ||
140 | |||
141 | impl<R: TreeRoot> FnPointerType<R> {} | ||
142 | |||
143 | // ForType | ||
144 | #[derive(Debug, Clone, Copy)] | ||
145 | pub struct ForType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
146 | syntax: SyntaxNode<R>, | ||
147 | } | ||
148 | |||
149 | impl<R: TreeRoot> AstNode<R> for ForType<R> { | ||
150 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
151 | match syntax.kind() { | ||
152 | FOR_TYPE => Some(ForType { syntax }), | ||
153 | _ => None, | ||
154 | } | ||
155 | } | ||
156 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
157 | } | ||
158 | |||
159 | impl<R: TreeRoot> ForType<R> {} | ||
160 | |||
89 | // ImplItem | 161 | // ImplItem |
90 | #[derive(Debug, Clone, Copy)] | 162 | #[derive(Debug, Clone, Copy)] |
91 | pub struct ImplItem<R: TreeRoot = Arc<SyntaxRoot>> { | 163 | pub struct ImplItem<R: TreeRoot = Arc<SyntaxRoot>> { |
@@ -104,6 +176,24 @@ impl<R: TreeRoot> AstNode<R> for ImplItem<R> { | |||
104 | 176 | ||
105 | impl<R: TreeRoot> ImplItem<R> {} | 177 | impl<R: TreeRoot> ImplItem<R> {} |
106 | 178 | ||
179 | // ImplTraitType | ||
180 | #[derive(Debug, Clone, Copy)] | ||
181 | pub struct ImplTraitType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
182 | syntax: SyntaxNode<R>, | ||
183 | } | ||
184 | |||
185 | impl<R: TreeRoot> AstNode<R> for ImplTraitType<R> { | ||
186 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
187 | match syntax.kind() { | ||
188 | IMPL_TRAIT_TYPE => Some(ImplTraitType { syntax }), | ||
189 | _ => None, | ||
190 | } | ||
191 | } | ||
192 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
193 | } | ||
194 | |||
195 | impl<R: TreeRoot> ImplTraitType<R> {} | ||
196 | |||
107 | // Module | 197 | // Module |
108 | #[derive(Debug, Clone, Copy)] | 198 | #[derive(Debug, Clone, Copy)] |
109 | pub struct Module<R: TreeRoot = Arc<SyntaxRoot>> { | 199 | pub struct Module<R: TreeRoot = Arc<SyntaxRoot>> { |
@@ -159,6 +249,132 @@ impl<R: TreeRoot> AstNode<R> for NameRef<R> { | |||
159 | 249 | ||
160 | impl<R: TreeRoot> NameRef<R> {} | 250 | impl<R: TreeRoot> NameRef<R> {} |
161 | 251 | ||
252 | // NeverType | ||
253 | #[derive(Debug, Clone, Copy)] | ||
254 | pub struct NeverType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
255 | syntax: SyntaxNode<R>, | ||
256 | } | ||
257 | |||
258 | impl<R: TreeRoot> AstNode<R> for NeverType<R> { | ||
259 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
260 | match syntax.kind() { | ||
261 | NEVER_TYPE => Some(NeverType { syntax }), | ||
262 | _ => None, | ||
263 | } | ||
264 | } | ||
265 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
266 | } | ||
267 | |||
268 | impl<R: TreeRoot> NeverType<R> {} | ||
269 | |||
270 | // ParenType | ||
271 | #[derive(Debug, Clone, Copy)] | ||
272 | pub struct ParenType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
273 | syntax: SyntaxNode<R>, | ||
274 | } | ||
275 | |||
276 | impl<R: TreeRoot> AstNode<R> for ParenType<R> { | ||
277 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
278 | match syntax.kind() { | ||
279 | PAREN_TYPE => Some(ParenType { syntax }), | ||
280 | _ => None, | ||
281 | } | ||
282 | } | ||
283 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
284 | } | ||
285 | |||
286 | impl<R: TreeRoot> ParenType<R> {} | ||
287 | |||
288 | // PathType | ||
289 | #[derive(Debug, Clone, Copy)] | ||
290 | pub struct PathType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
291 | syntax: SyntaxNode<R>, | ||
292 | } | ||
293 | |||
294 | impl<R: TreeRoot> AstNode<R> for PathType<R> { | ||
295 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
296 | match syntax.kind() { | ||
297 | PATH_TYPE => Some(PathType { syntax }), | ||
298 | _ => None, | ||
299 | } | ||
300 | } | ||
301 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
302 | } | ||
303 | |||
304 | impl<R: TreeRoot> PathType<R> {} | ||
305 | |||
306 | // PlaceholderType | ||
307 | #[derive(Debug, Clone, Copy)] | ||
308 | pub struct PlaceholderType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
309 | syntax: SyntaxNode<R>, | ||
310 | } | ||
311 | |||
312 | impl<R: TreeRoot> AstNode<R> for PlaceholderType<R> { | ||
313 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
314 | match syntax.kind() { | ||
315 | PLACEHOLDER_TYPE => Some(PlaceholderType { syntax }), | ||
316 | _ => None, | ||
317 | } | ||
318 | } | ||
319 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
320 | } | ||
321 | |||
322 | impl<R: TreeRoot> PlaceholderType<R> {} | ||
323 | |||
324 | // PointerType | ||
325 | #[derive(Debug, Clone, Copy)] | ||
326 | pub struct PointerType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
327 | syntax: SyntaxNode<R>, | ||
328 | } | ||
329 | |||
330 | impl<R: TreeRoot> AstNode<R> for PointerType<R> { | ||
331 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
332 | match syntax.kind() { | ||
333 | POINTER_TYPE => Some(PointerType { syntax }), | ||
334 | _ => None, | ||
335 | } | ||
336 | } | ||
337 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
338 | } | ||
339 | |||
340 | impl<R: TreeRoot> PointerType<R> {} | ||
341 | |||
342 | // ReferenceType | ||
343 | #[derive(Debug, Clone, Copy)] | ||
344 | pub struct ReferenceType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
345 | syntax: SyntaxNode<R>, | ||
346 | } | ||
347 | |||
348 | impl<R: TreeRoot> AstNode<R> for ReferenceType<R> { | ||
349 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
350 | match syntax.kind() { | ||
351 | REFERENCE_TYPE => Some(ReferenceType { syntax }), | ||
352 | _ => None, | ||
353 | } | ||
354 | } | ||
355 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
356 | } | ||
357 | |||
358 | impl<R: TreeRoot> ReferenceType<R> {} | ||
359 | |||
360 | // SliceType | ||
361 | #[derive(Debug, Clone, Copy)] | ||
362 | pub struct SliceType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
363 | syntax: SyntaxNode<R>, | ||
364 | } | ||
365 | |||
366 | impl<R: TreeRoot> AstNode<R> for SliceType<R> { | ||
367 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
368 | match syntax.kind() { | ||
369 | SLICE_TYPE => Some(SliceType { syntax }), | ||
370 | _ => None, | ||
371 | } | ||
372 | } | ||
373 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
374 | } | ||
375 | |||
376 | impl<R: TreeRoot> SliceType<R> {} | ||
377 | |||
162 | // StaticDef | 378 | // StaticDef |
163 | #[derive(Debug, Clone, Copy)] | 379 | #[derive(Debug, Clone, Copy)] |
164 | pub struct StaticDef<R: TreeRoot = Arc<SyntaxRoot>> { | 380 | pub struct StaticDef<R: TreeRoot = Arc<SyntaxRoot>> { |
@@ -216,6 +432,24 @@ impl<R: TreeRoot> AstNode<R> for TraitDef<R> { | |||
216 | impl<R: TreeRoot> ast::NameOwner<R> for TraitDef<R> {} | 432 | impl<R: TreeRoot> ast::NameOwner<R> for TraitDef<R> {} |
217 | impl<R: TreeRoot> TraitDef<R> {} | 433 | impl<R: TreeRoot> TraitDef<R> {} |
218 | 434 | ||
435 | // TupleType | ||
436 | #[derive(Debug, Clone, Copy)] | ||
437 | pub struct TupleType<R: TreeRoot = Arc<SyntaxRoot>> { | ||
438 | syntax: SyntaxNode<R>, | ||
439 | } | ||
440 | |||
441 | impl<R: TreeRoot> AstNode<R> for TupleType<R> { | ||
442 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
443 | match syntax.kind() { | ||
444 | TUPLE_TYPE => Some(TupleType { syntax }), | ||
445 | _ => None, | ||
446 | } | ||
447 | } | ||
448 | fn syntax(&self) -> &SyntaxNode<R> { &self.syntax } | ||
449 | } | ||
450 | |||
451 | impl<R: TreeRoot> TupleType<R> {} | ||
452 | |||
219 | // TypeDef | 453 | // TypeDef |
220 | #[derive(Debug, Clone, Copy)] | 454 | #[derive(Debug, Clone, Copy)] |
221 | pub struct TypeDef<R: TreeRoot = Arc<SyntaxRoot>> { | 455 | pub struct TypeDef<R: TreeRoot = Arc<SyntaxRoot>> { |
@@ -235,3 +469,61 @@ impl<R: TreeRoot> AstNode<R> for TypeDef<R> { | |||
235 | impl<R: TreeRoot> ast::NameOwner<R> for TypeDef<R> {} | 469 | impl<R: TreeRoot> ast::NameOwner<R> for TypeDef<R> {} |
236 | impl<R: TreeRoot> TypeDef<R> {} | 470 | impl<R: TreeRoot> TypeDef<R> {} |
237 | 471 | ||
472 | // TypeRef | ||
473 | #[derive(Debug, Clone, Copy)] | ||
474 | pub enum TypeRef<R: TreeRoot = Arc<SyntaxRoot>> { | ||
475 | ParenType(ParenType<R>), | ||
476 | TupleType(TupleType<R>), | ||
477 | NeverType(NeverType<R>), | ||
478 | PathType(PathType<R>), | ||
479 | PointerType(PointerType<R>), | ||
480 | ArrayType(ArrayType<R>), | ||
481 | SliceType(SliceType<R>), | ||
482 | ReferenceType(ReferenceType<R>), | ||
483 | PlaceholderType(PlaceholderType<R>), | ||
484 | FnPointerType(FnPointerType<R>), | ||
485 | ForType(ForType<R>), | ||
486 | ImplTraitType(ImplTraitType<R>), | ||
487 | DynTraitType(DynTraitType<R>), | ||
488 | } | ||
489 | |||
490 | impl<R: TreeRoot> AstNode<R> for TypeRef<R> { | ||
491 | fn cast(syntax: SyntaxNode<R>) -> Option<Self> { | ||
492 | match syntax.kind() { | ||
493 | PAREN_TYPE => Some(TypeRef::ParenType(ParenType { syntax })), | ||
494 | TUPLE_TYPE => Some(TypeRef::TupleType(TupleType { syntax })), | ||
495 | NEVER_TYPE => Some(TypeRef::NeverType(NeverType { syntax })), | ||
496 | PATH_TYPE => Some(TypeRef::PathType(PathType { syntax })), | ||
497 | POINTER_TYPE => Some(TypeRef::PointerType(PointerType { syntax })), | ||
498 | ARRAY_TYPE => Some(TypeRef::ArrayType(ArrayType { syntax })), | ||
499 | SLICE_TYPE => Some(TypeRef::SliceType(SliceType { syntax })), | ||
500 | REFERENCE_TYPE => Some(TypeRef::ReferenceType(ReferenceType { syntax })), | ||
501 | PLACEHOLDER_TYPE => Some(TypeRef::PlaceholderType(PlaceholderType { syntax })), | ||
502 | FN_POINTER_TYPE => Some(TypeRef::FnPointerType(FnPointerType { syntax })), | ||
503 | FOR_TYPE => Some(TypeRef::ForType(ForType { syntax })), | ||
504 | IMPL_TRAIT_TYPE => Some(TypeRef::ImplTraitType(ImplTraitType { syntax })), | ||
505 | DYN_TRAIT_TYPE => Some(TypeRef::DynTraitType(DynTraitType { syntax })), | ||
506 | _ => None, | ||
507 | } | ||
508 | } | ||
509 | fn syntax(&self) -> &SyntaxNode<R> { | ||
510 | match self { | ||
511 | TypeRef::ParenType(inner) => inner.syntax(), | ||
512 | TypeRef::TupleType(inner) => inner.syntax(), | ||
513 | TypeRef::NeverType(inner) => inner.syntax(), | ||
514 | TypeRef::PathType(inner) => inner.syntax(), | ||
515 | TypeRef::PointerType(inner) => inner.syntax(), | ||
516 | TypeRef::ArrayType(inner) => inner.syntax(), | ||
517 | TypeRef::SliceType(inner) => inner.syntax(), | ||
518 | TypeRef::ReferenceType(inner) => inner.syntax(), | ||
519 | TypeRef::PlaceholderType(inner) => inner.syntax(), | ||
520 | TypeRef::FnPointerType(inner) => inner.syntax(), | ||
521 | TypeRef::ForType(inner) => inner.syntax(), | ||
522 | TypeRef::ImplTraitType(inner) => inner.syntax(), | ||
523 | TypeRef::DynTraitType(inner) => inner.syntax(), | ||
524 | } | ||
525 | } | ||
526 | } | ||
527 | |||
528 | impl<R: TreeRoot> TypeRef<R> {} | ||
529 | |||