diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 1326 |
1 files changed, 1099 insertions, 227 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 420d9090c..bf056131e 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -9,6 +9,8 @@ | |||
9 | 9 | ||
10 | #![cfg_attr(rustfmt, rustfmt_skip)] | 10 | #![cfg_attr(rustfmt, rustfmt_skip)] |
11 | 11 | ||
12 | use std::hash::{Hash, Hasher}; | ||
13 | |||
12 | use crate::{ | 14 | use crate::{ |
13 | ast, | 15 | ast, |
14 | SyntaxNode, SyntaxNodeRef, AstNode, | 16 | SyntaxNode, SyntaxNodeRef, AstNode, |
@@ -17,12 +19,20 @@ use crate::{ | |||
17 | }; | 19 | }; |
18 | 20 | ||
19 | // ArgList | 21 | // ArgList |
20 | #[derive(Debug, Clone, Copy)] | 22 | #[derive(Debug, Clone, Copy,)] |
21 | pub struct ArgListNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 23 | pub struct ArgListNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
22 | syntax: SyntaxNode<R>, | 24 | pub(crate) syntax: SyntaxNode<R>, |
23 | } | 25 | } |
24 | pub type ArgList<'a> = ArgListNode<RefRoot<'a>>; | 26 | pub type ArgList<'a> = ArgListNode<RefRoot<'a>>; |
25 | 27 | ||
28 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ArgListNode<R1>> for ArgListNode<R2> { | ||
29 | fn eq(&self, other: &ArgListNode<R1>) -> bool { self.syntax == other.syntax } | ||
30 | } | ||
31 | impl<R: TreeRoot<RaTypes>> Eq for ArgListNode<R> {} | ||
32 | impl<R: TreeRoot<RaTypes>> Hash for ArgListNode<R> { | ||
33 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
34 | } | ||
35 | |||
26 | impl<'a> AstNode<'a> for ArgList<'a> { | 36 | impl<'a> AstNode<'a> for ArgList<'a> { |
27 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 37 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
28 | match syntax.kind() { | 38 | match syntax.kind() { |
@@ -50,12 +60,20 @@ impl<'a> ArgList<'a> { | |||
50 | } | 60 | } |
51 | 61 | ||
52 | // ArrayExpr | 62 | // ArrayExpr |
53 | #[derive(Debug, Clone, Copy)] | 63 | #[derive(Debug, Clone, Copy,)] |
54 | pub struct ArrayExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 64 | pub struct ArrayExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
55 | syntax: SyntaxNode<R>, | 65 | pub(crate) syntax: SyntaxNode<R>, |
56 | } | 66 | } |
57 | pub type ArrayExpr<'a> = ArrayExprNode<RefRoot<'a>>; | 67 | pub type ArrayExpr<'a> = ArrayExprNode<RefRoot<'a>>; |
58 | 68 | ||
69 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ArrayExprNode<R1>> for ArrayExprNode<R2> { | ||
70 | fn eq(&self, other: &ArrayExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
71 | } | ||
72 | impl<R: TreeRoot<RaTypes>> Eq for ArrayExprNode<R> {} | ||
73 | impl<R: TreeRoot<RaTypes>> Hash for ArrayExprNode<R> { | ||
74 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
75 | } | ||
76 | |||
59 | impl<'a> AstNode<'a> for ArrayExpr<'a> { | 77 | impl<'a> AstNode<'a> for ArrayExpr<'a> { |
60 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 78 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
61 | match syntax.kind() { | 79 | match syntax.kind() { |
@@ -79,12 +97,20 @@ impl<R: TreeRoot<RaTypes>> ArrayExprNode<R> { | |||
79 | impl<'a> ArrayExpr<'a> {} | 97 | impl<'a> ArrayExpr<'a> {} |
80 | 98 | ||
81 | // ArrayType | 99 | // ArrayType |
82 | #[derive(Debug, Clone, Copy)] | 100 | #[derive(Debug, Clone, Copy,)] |
83 | pub struct ArrayTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 101 | pub struct ArrayTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
84 | syntax: SyntaxNode<R>, | 102 | pub(crate) syntax: SyntaxNode<R>, |
85 | } | 103 | } |
86 | pub type ArrayType<'a> = ArrayTypeNode<RefRoot<'a>>; | 104 | pub type ArrayType<'a> = ArrayTypeNode<RefRoot<'a>>; |
87 | 105 | ||
106 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ArrayTypeNode<R1>> for ArrayTypeNode<R2> { | ||
107 | fn eq(&self, other: &ArrayTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
108 | } | ||
109 | impl<R: TreeRoot<RaTypes>> Eq for ArrayTypeNode<R> {} | ||
110 | impl<R: TreeRoot<RaTypes>> Hash for ArrayTypeNode<R> { | ||
111 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
112 | } | ||
113 | |||
88 | impl<'a> AstNode<'a> for ArrayType<'a> { | 114 | impl<'a> AstNode<'a> for ArrayType<'a> { |
89 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 115 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
90 | match syntax.kind() { | 116 | match syntax.kind() { |
@@ -108,12 +134,20 @@ impl<R: TreeRoot<RaTypes>> ArrayTypeNode<R> { | |||
108 | impl<'a> ArrayType<'a> {} | 134 | impl<'a> ArrayType<'a> {} |
109 | 135 | ||
110 | // Attr | 136 | // Attr |
111 | #[derive(Debug, Clone, Copy)] | 137 | #[derive(Debug, Clone, Copy,)] |
112 | pub struct AttrNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 138 | pub struct AttrNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
113 | syntax: SyntaxNode<R>, | 139 | pub(crate) syntax: SyntaxNode<R>, |
114 | } | 140 | } |
115 | pub type Attr<'a> = AttrNode<RefRoot<'a>>; | 141 | pub type Attr<'a> = AttrNode<RefRoot<'a>>; |
116 | 142 | ||
143 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<AttrNode<R1>> for AttrNode<R2> { | ||
144 | fn eq(&self, other: &AttrNode<R1>) -> bool { self.syntax == other.syntax } | ||
145 | } | ||
146 | impl<R: TreeRoot<RaTypes>> Eq for AttrNode<R> {} | ||
147 | impl<R: TreeRoot<RaTypes>> Hash for AttrNode<R> { | ||
148 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
149 | } | ||
150 | |||
117 | impl<'a> AstNode<'a> for Attr<'a> { | 151 | impl<'a> AstNode<'a> for Attr<'a> { |
118 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 152 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
119 | match syntax.kind() { | 153 | match syntax.kind() { |
@@ -141,12 +175,20 @@ impl<'a> Attr<'a> { | |||
141 | } | 175 | } |
142 | 176 | ||
143 | // BinExpr | 177 | // BinExpr |
144 | #[derive(Debug, Clone, Copy)] | 178 | #[derive(Debug, Clone, Copy,)] |
145 | pub struct BinExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 179 | pub struct BinExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
146 | syntax: SyntaxNode<R>, | 180 | pub(crate) syntax: SyntaxNode<R>, |
147 | } | 181 | } |
148 | pub type BinExpr<'a> = BinExprNode<RefRoot<'a>>; | 182 | pub type BinExpr<'a> = BinExprNode<RefRoot<'a>>; |
149 | 183 | ||
184 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<BinExprNode<R1>> for BinExprNode<R2> { | ||
185 | fn eq(&self, other: &BinExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
186 | } | ||
187 | impl<R: TreeRoot<RaTypes>> Eq for BinExprNode<R> {} | ||
188 | impl<R: TreeRoot<RaTypes>> Hash for BinExprNode<R> { | ||
189 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
190 | } | ||
191 | |||
150 | impl<'a> AstNode<'a> for BinExpr<'a> { | 192 | impl<'a> AstNode<'a> for BinExpr<'a> { |
151 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 193 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
152 | match syntax.kind() { | 194 | match syntax.kind() { |
@@ -170,12 +212,20 @@ impl<R: TreeRoot<RaTypes>> BinExprNode<R> { | |||
170 | impl<'a> BinExpr<'a> {} | 212 | impl<'a> BinExpr<'a> {} |
171 | 213 | ||
172 | // BindPat | 214 | // BindPat |
173 | #[derive(Debug, Clone, Copy)] | 215 | #[derive(Debug, Clone, Copy,)] |
174 | pub struct BindPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 216 | pub struct BindPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
175 | syntax: SyntaxNode<R>, | 217 | pub(crate) syntax: SyntaxNode<R>, |
176 | } | 218 | } |
177 | pub type BindPat<'a> = BindPatNode<RefRoot<'a>>; | 219 | pub type BindPat<'a> = BindPatNode<RefRoot<'a>>; |
178 | 220 | ||
221 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<BindPatNode<R1>> for BindPatNode<R2> { | ||
222 | fn eq(&self, other: &BindPatNode<R1>) -> bool { self.syntax == other.syntax } | ||
223 | } | ||
224 | impl<R: TreeRoot<RaTypes>> Eq for BindPatNode<R> {} | ||
225 | impl<R: TreeRoot<RaTypes>> Hash for BindPatNode<R> { | ||
226 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
227 | } | ||
228 | |||
179 | impl<'a> AstNode<'a> for BindPat<'a> { | 229 | impl<'a> AstNode<'a> for BindPat<'a> { |
180 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 230 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
181 | match syntax.kind() { | 231 | match syntax.kind() { |
@@ -200,12 +250,20 @@ impl<'a> ast::NameOwner<'a> for BindPat<'a> {} | |||
200 | impl<'a> BindPat<'a> {} | 250 | impl<'a> BindPat<'a> {} |
201 | 251 | ||
202 | // Block | 252 | // Block |
203 | #[derive(Debug, Clone, Copy)] | 253 | #[derive(Debug, Clone, Copy,)] |
204 | pub struct BlockNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 254 | pub struct BlockNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
205 | syntax: SyntaxNode<R>, | 255 | pub(crate) syntax: SyntaxNode<R>, |
206 | } | 256 | } |
207 | pub type Block<'a> = BlockNode<RefRoot<'a>>; | 257 | pub type Block<'a> = BlockNode<RefRoot<'a>>; |
208 | 258 | ||
259 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<BlockNode<R1>> for BlockNode<R2> { | ||
260 | fn eq(&self, other: &BlockNode<R1>) -> bool { self.syntax == other.syntax } | ||
261 | } | ||
262 | impl<R: TreeRoot<RaTypes>> Eq for BlockNode<R> {} | ||
263 | impl<R: TreeRoot<RaTypes>> Hash for BlockNode<R> { | ||
264 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
265 | } | ||
266 | |||
209 | impl<'a> AstNode<'a> for Block<'a> { | 267 | impl<'a> AstNode<'a> for Block<'a> { |
210 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 268 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
211 | match syntax.kind() { | 269 | match syntax.kind() { |
@@ -237,12 +295,20 @@ impl<'a> Block<'a> { | |||
237 | } | 295 | } |
238 | 296 | ||
239 | // BlockExpr | 297 | // BlockExpr |
240 | #[derive(Debug, Clone, Copy)] | 298 | #[derive(Debug, Clone, Copy,)] |
241 | pub struct BlockExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 299 | pub struct BlockExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
242 | syntax: SyntaxNode<R>, | 300 | pub(crate) syntax: SyntaxNode<R>, |
243 | } | 301 | } |
244 | pub type BlockExpr<'a> = BlockExprNode<RefRoot<'a>>; | 302 | pub type BlockExpr<'a> = BlockExprNode<RefRoot<'a>>; |
245 | 303 | ||
304 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<BlockExprNode<R1>> for BlockExprNode<R2> { | ||
305 | fn eq(&self, other: &BlockExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
306 | } | ||
307 | impl<R: TreeRoot<RaTypes>> Eq for BlockExprNode<R> {} | ||
308 | impl<R: TreeRoot<RaTypes>> Hash for BlockExprNode<R> { | ||
309 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
310 | } | ||
311 | |||
246 | impl<'a> AstNode<'a> for BlockExpr<'a> { | 312 | impl<'a> AstNode<'a> for BlockExpr<'a> { |
247 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 313 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
248 | match syntax.kind() { | 314 | match syntax.kind() { |
@@ -270,12 +336,20 @@ impl<'a> BlockExpr<'a> { | |||
270 | } | 336 | } |
271 | 337 | ||
272 | // BreakExpr | 338 | // BreakExpr |
273 | #[derive(Debug, Clone, Copy)] | 339 | #[derive(Debug, Clone, Copy,)] |
274 | pub struct BreakExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 340 | pub struct BreakExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
275 | syntax: SyntaxNode<R>, | 341 | pub(crate) syntax: SyntaxNode<R>, |
276 | } | 342 | } |
277 | pub type BreakExpr<'a> = BreakExprNode<RefRoot<'a>>; | 343 | pub type BreakExpr<'a> = BreakExprNode<RefRoot<'a>>; |
278 | 344 | ||
345 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<BreakExprNode<R1>> for BreakExprNode<R2> { | ||
346 | fn eq(&self, other: &BreakExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
347 | } | ||
348 | impl<R: TreeRoot<RaTypes>> Eq for BreakExprNode<R> {} | ||
349 | impl<R: TreeRoot<RaTypes>> Hash for BreakExprNode<R> { | ||
350 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
351 | } | ||
352 | |||
279 | impl<'a> AstNode<'a> for BreakExpr<'a> { | 353 | impl<'a> AstNode<'a> for BreakExpr<'a> { |
280 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 354 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
281 | match syntax.kind() { | 355 | match syntax.kind() { |
@@ -298,13 +372,95 @@ impl<R: TreeRoot<RaTypes>> BreakExprNode<R> { | |||
298 | 372 | ||
299 | impl<'a> BreakExpr<'a> {} | 373 | impl<'a> BreakExpr<'a> {} |
300 | 374 | ||
375 | // Byte | ||
376 | #[derive(Debug, Clone, Copy,)] | ||
377 | pub struct ByteNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
378 | pub(crate) syntax: SyntaxNode<R>, | ||
379 | } | ||
380 | pub type Byte<'a> = ByteNode<RefRoot<'a>>; | ||
381 | |||
382 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ByteNode<R1>> for ByteNode<R2> { | ||
383 | fn eq(&self, other: &ByteNode<R1>) -> bool { self.syntax == other.syntax } | ||
384 | } | ||
385 | impl<R: TreeRoot<RaTypes>> Eq for ByteNode<R> {} | ||
386 | impl<R: TreeRoot<RaTypes>> Hash for ByteNode<R> { | ||
387 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
388 | } | ||
389 | |||
390 | impl<'a> AstNode<'a> for Byte<'a> { | ||
391 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
392 | match syntax.kind() { | ||
393 | BYTE => Some(Byte { syntax }), | ||
394 | _ => None, | ||
395 | } | ||
396 | } | ||
397 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
398 | } | ||
399 | |||
400 | impl<R: TreeRoot<RaTypes>> ByteNode<R> { | ||
401 | pub fn borrowed(&self) -> Byte { | ||
402 | ByteNode { syntax: self.syntax.borrowed() } | ||
403 | } | ||
404 | pub fn owned(&self) -> ByteNode { | ||
405 | ByteNode { syntax: self.syntax.owned() } | ||
406 | } | ||
407 | } | ||
408 | |||
409 | |||
410 | impl<'a> Byte<'a> {} | ||
411 | |||
412 | // ByteString | ||
413 | #[derive(Debug, Clone, Copy,)] | ||
414 | pub struct ByteStringNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
415 | pub(crate) syntax: SyntaxNode<R>, | ||
416 | } | ||
417 | pub type ByteString<'a> = ByteStringNode<RefRoot<'a>>; | ||
418 | |||
419 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ByteStringNode<R1>> for ByteStringNode<R2> { | ||
420 | fn eq(&self, other: &ByteStringNode<R1>) -> bool { self.syntax == other.syntax } | ||
421 | } | ||
422 | impl<R: TreeRoot<RaTypes>> Eq for ByteStringNode<R> {} | ||
423 | impl<R: TreeRoot<RaTypes>> Hash for ByteStringNode<R> { | ||
424 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
425 | } | ||
426 | |||
427 | impl<'a> AstNode<'a> for ByteString<'a> { | ||
428 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
429 | match syntax.kind() { | ||
430 | BYTE_STRING => Some(ByteString { syntax }), | ||
431 | _ => None, | ||
432 | } | ||
433 | } | ||
434 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
435 | } | ||
436 | |||
437 | impl<R: TreeRoot<RaTypes>> ByteStringNode<R> { | ||
438 | pub fn borrowed(&self) -> ByteString { | ||
439 | ByteStringNode { syntax: self.syntax.borrowed() } | ||
440 | } | ||
441 | pub fn owned(&self) -> ByteStringNode { | ||
442 | ByteStringNode { syntax: self.syntax.owned() } | ||
443 | } | ||
444 | } | ||
445 | |||
446 | |||
447 | impl<'a> ByteString<'a> {} | ||
448 | |||
301 | // CallExpr | 449 | // CallExpr |
302 | #[derive(Debug, Clone, Copy)] | 450 | #[derive(Debug, Clone, Copy,)] |
303 | pub struct CallExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 451 | pub struct CallExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
304 | syntax: SyntaxNode<R>, | 452 | pub(crate) syntax: SyntaxNode<R>, |
305 | } | 453 | } |
306 | pub type CallExpr<'a> = CallExprNode<RefRoot<'a>>; | 454 | pub type CallExpr<'a> = CallExprNode<RefRoot<'a>>; |
307 | 455 | ||
456 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<CallExprNode<R1>> for CallExprNode<R2> { | ||
457 | fn eq(&self, other: &CallExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
458 | } | ||
459 | impl<R: TreeRoot<RaTypes>> Eq for CallExprNode<R> {} | ||
460 | impl<R: TreeRoot<RaTypes>> Hash for CallExprNode<R> { | ||
461 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
462 | } | ||
463 | |||
308 | impl<'a> AstNode<'a> for CallExpr<'a> { | 464 | impl<'a> AstNode<'a> for CallExpr<'a> { |
309 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 465 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
310 | match syntax.kind() { | 466 | match syntax.kind() { |
@@ -333,12 +489,20 @@ impl<'a> CallExpr<'a> { | |||
333 | } | 489 | } |
334 | 490 | ||
335 | // CastExpr | 491 | // CastExpr |
336 | #[derive(Debug, Clone, Copy)] | 492 | #[derive(Debug, Clone, Copy,)] |
337 | pub struct CastExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 493 | pub struct CastExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
338 | syntax: SyntaxNode<R>, | 494 | pub(crate) syntax: SyntaxNode<R>, |
339 | } | 495 | } |
340 | pub type CastExpr<'a> = CastExprNode<RefRoot<'a>>; | 496 | pub type CastExpr<'a> = CastExprNode<RefRoot<'a>>; |
341 | 497 | ||
498 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<CastExprNode<R1>> for CastExprNode<R2> { | ||
499 | fn eq(&self, other: &CastExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
500 | } | ||
501 | impl<R: TreeRoot<RaTypes>> Eq for CastExprNode<R> {} | ||
502 | impl<R: TreeRoot<RaTypes>> Hash for CastExprNode<R> { | ||
503 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
504 | } | ||
505 | |||
342 | impl<'a> AstNode<'a> for CastExpr<'a> { | 506 | impl<'a> AstNode<'a> for CastExpr<'a> { |
343 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 507 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
344 | match syntax.kind() { | 508 | match syntax.kind() { |
@@ -362,12 +526,20 @@ impl<R: TreeRoot<RaTypes>> CastExprNode<R> { | |||
362 | impl<'a> CastExpr<'a> {} | 526 | impl<'a> CastExpr<'a> {} |
363 | 527 | ||
364 | // Char | 528 | // Char |
365 | #[derive(Debug, Clone, Copy)] | 529 | #[derive(Debug, Clone, Copy,)] |
366 | pub struct CharNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 530 | pub struct CharNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
367 | syntax: SyntaxNode<R>, | 531 | pub(crate) syntax: SyntaxNode<R>, |
368 | } | 532 | } |
369 | pub type Char<'a> = CharNode<RefRoot<'a>>; | 533 | pub type Char<'a> = CharNode<RefRoot<'a>>; |
370 | 534 | ||
535 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<CharNode<R1>> for CharNode<R2> { | ||
536 | fn eq(&self, other: &CharNode<R1>) -> bool { self.syntax == other.syntax } | ||
537 | } | ||
538 | impl<R: TreeRoot<RaTypes>> Eq for CharNode<R> {} | ||
539 | impl<R: TreeRoot<RaTypes>> Hash for CharNode<R> { | ||
540 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
541 | } | ||
542 | |||
371 | impl<'a> AstNode<'a> for Char<'a> { | 543 | impl<'a> AstNode<'a> for Char<'a> { |
372 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 544 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
373 | match syntax.kind() { | 545 | match syntax.kind() { |
@@ -391,12 +563,20 @@ impl<R: TreeRoot<RaTypes>> CharNode<R> { | |||
391 | impl<'a> Char<'a> {} | 563 | impl<'a> Char<'a> {} |
392 | 564 | ||
393 | // Comment | 565 | // Comment |
394 | #[derive(Debug, Clone, Copy)] | 566 | #[derive(Debug, Clone, Copy,)] |
395 | pub struct CommentNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 567 | pub struct CommentNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
396 | syntax: SyntaxNode<R>, | 568 | pub(crate) syntax: SyntaxNode<R>, |
397 | } | 569 | } |
398 | pub type Comment<'a> = CommentNode<RefRoot<'a>>; | 570 | pub type Comment<'a> = CommentNode<RefRoot<'a>>; |
399 | 571 | ||
572 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<CommentNode<R1>> for CommentNode<R2> { | ||
573 | fn eq(&self, other: &CommentNode<R1>) -> bool { self.syntax == other.syntax } | ||
574 | } | ||
575 | impl<R: TreeRoot<RaTypes>> Eq for CommentNode<R> {} | ||
576 | impl<R: TreeRoot<RaTypes>> Hash for CommentNode<R> { | ||
577 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
578 | } | ||
579 | |||
400 | impl<'a> AstNode<'a> for Comment<'a> { | 580 | impl<'a> AstNode<'a> for Comment<'a> { |
401 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 581 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
402 | match syntax.kind() { | 582 | match syntax.kind() { |
@@ -420,12 +600,20 @@ impl<R: TreeRoot<RaTypes>> CommentNode<R> { | |||
420 | impl<'a> Comment<'a> {} | 600 | impl<'a> Comment<'a> {} |
421 | 601 | ||
422 | // Condition | 602 | // Condition |
423 | #[derive(Debug, Clone, Copy)] | 603 | #[derive(Debug, Clone, Copy,)] |
424 | pub struct ConditionNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 604 | pub struct ConditionNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
425 | syntax: SyntaxNode<R>, | 605 | pub(crate) syntax: SyntaxNode<R>, |
426 | } | 606 | } |
427 | pub type Condition<'a> = ConditionNode<RefRoot<'a>>; | 607 | pub type Condition<'a> = ConditionNode<RefRoot<'a>>; |
428 | 608 | ||
609 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ConditionNode<R1>> for ConditionNode<R2> { | ||
610 | fn eq(&self, other: &ConditionNode<R1>) -> bool { self.syntax == other.syntax } | ||
611 | } | ||
612 | impl<R: TreeRoot<RaTypes>> Eq for ConditionNode<R> {} | ||
613 | impl<R: TreeRoot<RaTypes>> Hash for ConditionNode<R> { | ||
614 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
615 | } | ||
616 | |||
429 | impl<'a> AstNode<'a> for Condition<'a> { | 617 | impl<'a> AstNode<'a> for Condition<'a> { |
430 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 618 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
431 | match syntax.kind() { | 619 | match syntax.kind() { |
@@ -457,12 +645,20 @@ impl<'a> Condition<'a> { | |||
457 | } | 645 | } |
458 | 646 | ||
459 | // ConstDef | 647 | // ConstDef |
460 | #[derive(Debug, Clone, Copy)] | 648 | #[derive(Debug, Clone, Copy,)] |
461 | pub struct ConstDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 649 | pub struct ConstDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
462 | syntax: SyntaxNode<R>, | 650 | pub(crate) syntax: SyntaxNode<R>, |
463 | } | 651 | } |
464 | pub type ConstDef<'a> = ConstDefNode<RefRoot<'a>>; | 652 | pub type ConstDef<'a> = ConstDefNode<RefRoot<'a>>; |
465 | 653 | ||
654 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ConstDefNode<R1>> for ConstDefNode<R2> { | ||
655 | fn eq(&self, other: &ConstDefNode<R1>) -> bool { self.syntax == other.syntax } | ||
656 | } | ||
657 | impl<R: TreeRoot<RaTypes>> Eq for ConstDefNode<R> {} | ||
658 | impl<R: TreeRoot<RaTypes>> Hash for ConstDefNode<R> { | ||
659 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
660 | } | ||
661 | |||
466 | impl<'a> AstNode<'a> for ConstDef<'a> { | 662 | impl<'a> AstNode<'a> for ConstDef<'a> { |
467 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 663 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
468 | match syntax.kind() { | 664 | match syntax.kind() { |
@@ -486,15 +682,24 @@ impl<R: TreeRoot<RaTypes>> ConstDefNode<R> { | |||
486 | impl<'a> ast::NameOwner<'a> for ConstDef<'a> {} | 682 | impl<'a> ast::NameOwner<'a> for ConstDef<'a> {} |
487 | impl<'a> ast::TypeParamsOwner<'a> for ConstDef<'a> {} | 683 | impl<'a> ast::TypeParamsOwner<'a> for ConstDef<'a> {} |
488 | impl<'a> ast::AttrsOwner<'a> for ConstDef<'a> {} | 684 | impl<'a> ast::AttrsOwner<'a> for ConstDef<'a> {} |
685 | impl<'a> ast::DocCommentsOwner<'a> for ConstDef<'a> {} | ||
489 | impl<'a> ConstDef<'a> {} | 686 | impl<'a> ConstDef<'a> {} |
490 | 687 | ||
491 | // ContinueExpr | 688 | // ContinueExpr |
492 | #[derive(Debug, Clone, Copy)] | 689 | #[derive(Debug, Clone, Copy,)] |
493 | pub struct ContinueExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 690 | pub struct ContinueExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
494 | syntax: SyntaxNode<R>, | 691 | pub(crate) syntax: SyntaxNode<R>, |
495 | } | 692 | } |
496 | pub type ContinueExpr<'a> = ContinueExprNode<RefRoot<'a>>; | 693 | pub type ContinueExpr<'a> = ContinueExprNode<RefRoot<'a>>; |
497 | 694 | ||
695 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ContinueExprNode<R1>> for ContinueExprNode<R2> { | ||
696 | fn eq(&self, other: &ContinueExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
697 | } | ||
698 | impl<R: TreeRoot<RaTypes>> Eq for ContinueExprNode<R> {} | ||
699 | impl<R: TreeRoot<RaTypes>> Hash for ContinueExprNode<R> { | ||
700 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
701 | } | ||
702 | |||
498 | impl<'a> AstNode<'a> for ContinueExpr<'a> { | 703 | impl<'a> AstNode<'a> for ContinueExpr<'a> { |
499 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 704 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
500 | match syntax.kind() { | 705 | match syntax.kind() { |
@@ -518,12 +723,20 @@ impl<R: TreeRoot<RaTypes>> ContinueExprNode<R> { | |||
518 | impl<'a> ContinueExpr<'a> {} | 723 | impl<'a> ContinueExpr<'a> {} |
519 | 724 | ||
520 | // DynTraitType | 725 | // DynTraitType |
521 | #[derive(Debug, Clone, Copy)] | 726 | #[derive(Debug, Clone, Copy,)] |
522 | pub struct DynTraitTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 727 | pub struct DynTraitTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
523 | syntax: SyntaxNode<R>, | 728 | pub(crate) syntax: SyntaxNode<R>, |
524 | } | 729 | } |
525 | pub type DynTraitType<'a> = DynTraitTypeNode<RefRoot<'a>>; | 730 | pub type DynTraitType<'a> = DynTraitTypeNode<RefRoot<'a>>; |
526 | 731 | ||
732 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<DynTraitTypeNode<R1>> for DynTraitTypeNode<R2> { | ||
733 | fn eq(&self, other: &DynTraitTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
734 | } | ||
735 | impl<R: TreeRoot<RaTypes>> Eq for DynTraitTypeNode<R> {} | ||
736 | impl<R: TreeRoot<RaTypes>> Hash for DynTraitTypeNode<R> { | ||
737 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
738 | } | ||
739 | |||
527 | impl<'a> AstNode<'a> for DynTraitType<'a> { | 740 | impl<'a> AstNode<'a> for DynTraitType<'a> { |
528 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 741 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
529 | match syntax.kind() { | 742 | match syntax.kind() { |
@@ -547,12 +760,20 @@ impl<R: TreeRoot<RaTypes>> DynTraitTypeNode<R> { | |||
547 | impl<'a> DynTraitType<'a> {} | 760 | impl<'a> DynTraitType<'a> {} |
548 | 761 | ||
549 | // EnumDef | 762 | // EnumDef |
550 | #[derive(Debug, Clone, Copy)] | 763 | #[derive(Debug, Clone, Copy,)] |
551 | pub struct EnumDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 764 | pub struct EnumDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
552 | syntax: SyntaxNode<R>, | 765 | pub(crate) syntax: SyntaxNode<R>, |
553 | } | 766 | } |
554 | pub type EnumDef<'a> = EnumDefNode<RefRoot<'a>>; | 767 | pub type EnumDef<'a> = EnumDefNode<RefRoot<'a>>; |
555 | 768 | ||
769 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<EnumDefNode<R1>> for EnumDefNode<R2> { | ||
770 | fn eq(&self, other: &EnumDefNode<R1>) -> bool { self.syntax == other.syntax } | ||
771 | } | ||
772 | impl<R: TreeRoot<RaTypes>> Eq for EnumDefNode<R> {} | ||
773 | impl<R: TreeRoot<RaTypes>> Hash for EnumDefNode<R> { | ||
774 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
775 | } | ||
776 | |||
556 | impl<'a> AstNode<'a> for EnumDef<'a> { | 777 | impl<'a> AstNode<'a> for EnumDef<'a> { |
557 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 778 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
558 | match syntax.kind() { | 779 | match syntax.kind() { |
@@ -576,10 +797,11 @@ impl<R: TreeRoot<RaTypes>> EnumDefNode<R> { | |||
576 | impl<'a> ast::NameOwner<'a> for EnumDef<'a> {} | 797 | impl<'a> ast::NameOwner<'a> for EnumDef<'a> {} |
577 | impl<'a> ast::TypeParamsOwner<'a> for EnumDef<'a> {} | 798 | impl<'a> ast::TypeParamsOwner<'a> for EnumDef<'a> {} |
578 | impl<'a> ast::AttrsOwner<'a> for EnumDef<'a> {} | 799 | impl<'a> ast::AttrsOwner<'a> for EnumDef<'a> {} |
800 | impl<'a> ast::DocCommentsOwner<'a> for EnumDef<'a> {} | ||
579 | impl<'a> EnumDef<'a> {} | 801 | impl<'a> EnumDef<'a> {} |
580 | 802 | ||
581 | // Expr | 803 | // Expr |
582 | #[derive(Debug, Clone, Copy)] | 804 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
583 | pub enum Expr<'a> { | 805 | pub enum Expr<'a> { |
584 | TupleExpr(TupleExpr<'a>), | 806 | TupleExpr(TupleExpr<'a>), |
585 | ArrayExpr(ArrayExpr<'a>), | 807 | ArrayExpr(ArrayExpr<'a>), |
@@ -694,12 +916,20 @@ impl<'a> AstNode<'a> for Expr<'a> { | |||
694 | impl<'a> Expr<'a> {} | 916 | impl<'a> Expr<'a> {} |
695 | 917 | ||
696 | // ExprStmt | 918 | // ExprStmt |
697 | #[derive(Debug, Clone, Copy)] | 919 | #[derive(Debug, Clone, Copy,)] |
698 | pub struct ExprStmtNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 920 | pub struct ExprStmtNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
699 | syntax: SyntaxNode<R>, | 921 | pub(crate) syntax: SyntaxNode<R>, |
700 | } | 922 | } |
701 | pub type ExprStmt<'a> = ExprStmtNode<RefRoot<'a>>; | 923 | pub type ExprStmt<'a> = ExprStmtNode<RefRoot<'a>>; |
702 | 924 | ||
925 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ExprStmtNode<R1>> for ExprStmtNode<R2> { | ||
926 | fn eq(&self, other: &ExprStmtNode<R1>) -> bool { self.syntax == other.syntax } | ||
927 | } | ||
928 | impl<R: TreeRoot<RaTypes>> Eq for ExprStmtNode<R> {} | ||
929 | impl<R: TreeRoot<RaTypes>> Hash for ExprStmtNode<R> { | ||
930 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
931 | } | ||
932 | |||
703 | impl<'a> AstNode<'a> for ExprStmt<'a> { | 933 | impl<'a> AstNode<'a> for ExprStmt<'a> { |
704 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 934 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
705 | match syntax.kind() { | 935 | match syntax.kind() { |
@@ -727,12 +957,20 @@ impl<'a> ExprStmt<'a> { | |||
727 | } | 957 | } |
728 | 958 | ||
729 | // ExternCrateItem | 959 | // ExternCrateItem |
730 | #[derive(Debug, Clone, Copy)] | 960 | #[derive(Debug, Clone, Copy,)] |
731 | pub struct ExternCrateItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 961 | pub struct ExternCrateItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
732 | syntax: SyntaxNode<R>, | 962 | pub(crate) syntax: SyntaxNode<R>, |
733 | } | 963 | } |
734 | pub type ExternCrateItem<'a> = ExternCrateItemNode<RefRoot<'a>>; | 964 | pub type ExternCrateItem<'a> = ExternCrateItemNode<RefRoot<'a>>; |
735 | 965 | ||
966 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ExternCrateItemNode<R1>> for ExternCrateItemNode<R2> { | ||
967 | fn eq(&self, other: &ExternCrateItemNode<R1>) -> bool { self.syntax == other.syntax } | ||
968 | } | ||
969 | impl<R: TreeRoot<RaTypes>> Eq for ExternCrateItemNode<R> {} | ||
970 | impl<R: TreeRoot<RaTypes>> Hash for ExternCrateItemNode<R> { | ||
971 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
972 | } | ||
973 | |||
736 | impl<'a> AstNode<'a> for ExternCrateItem<'a> { | 974 | impl<'a> AstNode<'a> for ExternCrateItem<'a> { |
737 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 975 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
738 | match syntax.kind() { | 976 | match syntax.kind() { |
@@ -756,12 +994,20 @@ impl<R: TreeRoot<RaTypes>> ExternCrateItemNode<R> { | |||
756 | impl<'a> ExternCrateItem<'a> {} | 994 | impl<'a> ExternCrateItem<'a> {} |
757 | 995 | ||
758 | // FieldExpr | 996 | // FieldExpr |
759 | #[derive(Debug, Clone, Copy)] | 997 | #[derive(Debug, Clone, Copy,)] |
760 | pub struct FieldExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 998 | pub struct FieldExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
761 | syntax: SyntaxNode<R>, | 999 | pub(crate) syntax: SyntaxNode<R>, |
762 | } | 1000 | } |
763 | pub type FieldExpr<'a> = FieldExprNode<RefRoot<'a>>; | 1001 | pub type FieldExpr<'a> = FieldExprNode<RefRoot<'a>>; |
764 | 1002 | ||
1003 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<FieldExprNode<R1>> for FieldExprNode<R2> { | ||
1004 | fn eq(&self, other: &FieldExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
1005 | } | ||
1006 | impl<R: TreeRoot<RaTypes>> Eq for FieldExprNode<R> {} | ||
1007 | impl<R: TreeRoot<RaTypes>> Hash for FieldExprNode<R> { | ||
1008 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1009 | } | ||
1010 | |||
765 | impl<'a> AstNode<'a> for FieldExpr<'a> { | 1011 | impl<'a> AstNode<'a> for FieldExpr<'a> { |
766 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1012 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
767 | match syntax.kind() { | 1013 | match syntax.kind() { |
@@ -785,12 +1031,20 @@ impl<R: TreeRoot<RaTypes>> FieldExprNode<R> { | |||
785 | impl<'a> FieldExpr<'a> {} | 1031 | impl<'a> FieldExpr<'a> {} |
786 | 1032 | ||
787 | // FieldPatList | 1033 | // FieldPatList |
788 | #[derive(Debug, Clone, Copy)] | 1034 | #[derive(Debug, Clone, Copy,)] |
789 | pub struct FieldPatListNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1035 | pub struct FieldPatListNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
790 | syntax: SyntaxNode<R>, | 1036 | pub(crate) syntax: SyntaxNode<R>, |
791 | } | 1037 | } |
792 | pub type FieldPatList<'a> = FieldPatListNode<RefRoot<'a>>; | 1038 | pub type FieldPatList<'a> = FieldPatListNode<RefRoot<'a>>; |
793 | 1039 | ||
1040 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<FieldPatListNode<R1>> for FieldPatListNode<R2> { | ||
1041 | fn eq(&self, other: &FieldPatListNode<R1>) -> bool { self.syntax == other.syntax } | ||
1042 | } | ||
1043 | impl<R: TreeRoot<RaTypes>> Eq for FieldPatListNode<R> {} | ||
1044 | impl<R: TreeRoot<RaTypes>> Hash for FieldPatListNode<R> { | ||
1045 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1046 | } | ||
1047 | |||
794 | impl<'a> AstNode<'a> for FieldPatList<'a> { | 1048 | impl<'a> AstNode<'a> for FieldPatList<'a> { |
795 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1049 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
796 | match syntax.kind() { | 1050 | match syntax.kind() { |
@@ -814,12 +1068,20 @@ impl<R: TreeRoot<RaTypes>> FieldPatListNode<R> { | |||
814 | impl<'a> FieldPatList<'a> {} | 1068 | impl<'a> FieldPatList<'a> {} |
815 | 1069 | ||
816 | // FnDef | 1070 | // FnDef |
817 | #[derive(Debug, Clone, Copy)] | 1071 | #[derive(Debug, Clone, Copy,)] |
818 | pub struct FnDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1072 | pub struct FnDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
819 | syntax: SyntaxNode<R>, | 1073 | pub(crate) syntax: SyntaxNode<R>, |
820 | } | 1074 | } |
821 | pub type FnDef<'a> = FnDefNode<RefRoot<'a>>; | 1075 | pub type FnDef<'a> = FnDefNode<RefRoot<'a>>; |
822 | 1076 | ||
1077 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<FnDefNode<R1>> for FnDefNode<R2> { | ||
1078 | fn eq(&self, other: &FnDefNode<R1>) -> bool { self.syntax == other.syntax } | ||
1079 | } | ||
1080 | impl<R: TreeRoot<RaTypes>> Eq for FnDefNode<R> {} | ||
1081 | impl<R: TreeRoot<RaTypes>> Hash for FnDefNode<R> { | ||
1082 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1083 | } | ||
1084 | |||
823 | impl<'a> AstNode<'a> for FnDef<'a> { | 1085 | impl<'a> AstNode<'a> for FnDef<'a> { |
824 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1086 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
825 | match syntax.kind() { | 1087 | match syntax.kind() { |
@@ -859,12 +1121,20 @@ impl<'a> FnDef<'a> { | |||
859 | } | 1121 | } |
860 | 1122 | ||
861 | // FnPointerType | 1123 | // FnPointerType |
862 | #[derive(Debug, Clone, Copy)] | 1124 | #[derive(Debug, Clone, Copy,)] |
863 | pub struct FnPointerTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1125 | pub struct FnPointerTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
864 | syntax: SyntaxNode<R>, | 1126 | pub(crate) syntax: SyntaxNode<R>, |
865 | } | 1127 | } |
866 | pub type FnPointerType<'a> = FnPointerTypeNode<RefRoot<'a>>; | 1128 | pub type FnPointerType<'a> = FnPointerTypeNode<RefRoot<'a>>; |
867 | 1129 | ||
1130 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<FnPointerTypeNode<R1>> for FnPointerTypeNode<R2> { | ||
1131 | fn eq(&self, other: &FnPointerTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
1132 | } | ||
1133 | impl<R: TreeRoot<RaTypes>> Eq for FnPointerTypeNode<R> {} | ||
1134 | impl<R: TreeRoot<RaTypes>> Hash for FnPointerTypeNode<R> { | ||
1135 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1136 | } | ||
1137 | |||
868 | impl<'a> AstNode<'a> for FnPointerType<'a> { | 1138 | impl<'a> AstNode<'a> for FnPointerType<'a> { |
869 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1139 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
870 | match syntax.kind() { | 1140 | match syntax.kind() { |
@@ -888,12 +1158,20 @@ impl<R: TreeRoot<RaTypes>> FnPointerTypeNode<R> { | |||
888 | impl<'a> FnPointerType<'a> {} | 1158 | impl<'a> FnPointerType<'a> {} |
889 | 1159 | ||
890 | // ForExpr | 1160 | // ForExpr |
891 | #[derive(Debug, Clone, Copy)] | 1161 | #[derive(Debug, Clone, Copy,)] |
892 | pub struct ForExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1162 | pub struct ForExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
893 | syntax: SyntaxNode<R>, | 1163 | pub(crate) syntax: SyntaxNode<R>, |
894 | } | 1164 | } |
895 | pub type ForExpr<'a> = ForExprNode<RefRoot<'a>>; | 1165 | pub type ForExpr<'a> = ForExprNode<RefRoot<'a>>; |
896 | 1166 | ||
1167 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ForExprNode<R1>> for ForExprNode<R2> { | ||
1168 | fn eq(&self, other: &ForExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
1169 | } | ||
1170 | impl<R: TreeRoot<RaTypes>> Eq for ForExprNode<R> {} | ||
1171 | impl<R: TreeRoot<RaTypes>> Hash for ForExprNode<R> { | ||
1172 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1173 | } | ||
1174 | |||
897 | impl<'a> AstNode<'a> for ForExpr<'a> { | 1175 | impl<'a> AstNode<'a> for ForExpr<'a> { |
898 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1176 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
899 | match syntax.kind() { | 1177 | match syntax.kind() { |
@@ -926,12 +1204,20 @@ impl<'a> ForExpr<'a> { | |||
926 | } | 1204 | } |
927 | 1205 | ||
928 | // ForType | 1206 | // ForType |
929 | #[derive(Debug, Clone, Copy)] | 1207 | #[derive(Debug, Clone, Copy,)] |
930 | pub struct ForTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1208 | pub struct ForTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
931 | syntax: SyntaxNode<R>, | 1209 | pub(crate) syntax: SyntaxNode<R>, |
932 | } | 1210 | } |
933 | pub type ForType<'a> = ForTypeNode<RefRoot<'a>>; | 1211 | pub type ForType<'a> = ForTypeNode<RefRoot<'a>>; |
934 | 1212 | ||
1213 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ForTypeNode<R1>> for ForTypeNode<R2> { | ||
1214 | fn eq(&self, other: &ForTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
1215 | } | ||
1216 | impl<R: TreeRoot<RaTypes>> Eq for ForTypeNode<R> {} | ||
1217 | impl<R: TreeRoot<RaTypes>> Hash for ForTypeNode<R> { | ||
1218 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1219 | } | ||
1220 | |||
935 | impl<'a> AstNode<'a> for ForType<'a> { | 1221 | impl<'a> AstNode<'a> for ForType<'a> { |
936 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1222 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
937 | match syntax.kind() { | 1223 | match syntax.kind() { |
@@ -955,12 +1241,20 @@ impl<R: TreeRoot<RaTypes>> ForTypeNode<R> { | |||
955 | impl<'a> ForType<'a> {} | 1241 | impl<'a> ForType<'a> {} |
956 | 1242 | ||
957 | // IfExpr | 1243 | // IfExpr |
958 | #[derive(Debug, Clone, Copy)] | 1244 | #[derive(Debug, Clone, Copy,)] |
959 | pub struct IfExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1245 | pub struct IfExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
960 | syntax: SyntaxNode<R>, | 1246 | pub(crate) syntax: SyntaxNode<R>, |
961 | } | 1247 | } |
962 | pub type IfExpr<'a> = IfExprNode<RefRoot<'a>>; | 1248 | pub type IfExpr<'a> = IfExprNode<RefRoot<'a>>; |
963 | 1249 | ||
1250 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<IfExprNode<R1>> for IfExprNode<R2> { | ||
1251 | fn eq(&self, other: &IfExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
1252 | } | ||
1253 | impl<R: TreeRoot<RaTypes>> Eq for IfExprNode<R> {} | ||
1254 | impl<R: TreeRoot<RaTypes>> Hash for IfExprNode<R> { | ||
1255 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1256 | } | ||
1257 | |||
964 | impl<'a> AstNode<'a> for IfExpr<'a> { | 1258 | impl<'a> AstNode<'a> for IfExpr<'a> { |
965 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1259 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
966 | match syntax.kind() { | 1260 | match syntax.kind() { |
@@ -988,12 +1282,20 @@ impl<'a> IfExpr<'a> { | |||
988 | } | 1282 | } |
989 | 1283 | ||
990 | // ImplItem | 1284 | // ImplItem |
991 | #[derive(Debug, Clone, Copy)] | 1285 | #[derive(Debug, Clone, Copy,)] |
992 | pub struct ImplItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1286 | pub struct ImplItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
993 | syntax: SyntaxNode<R>, | 1287 | pub(crate) syntax: SyntaxNode<R>, |
994 | } | 1288 | } |
995 | pub type ImplItem<'a> = ImplItemNode<RefRoot<'a>>; | 1289 | pub type ImplItem<'a> = ImplItemNode<RefRoot<'a>>; |
996 | 1290 | ||
1291 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ImplItemNode<R1>> for ImplItemNode<R2> { | ||
1292 | fn eq(&self, other: &ImplItemNode<R1>) -> bool { self.syntax == other.syntax } | ||
1293 | } | ||
1294 | impl<R: TreeRoot<RaTypes>> Eq for ImplItemNode<R> {} | ||
1295 | impl<R: TreeRoot<RaTypes>> Hash for ImplItemNode<R> { | ||
1296 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1297 | } | ||
1298 | |||
997 | impl<'a> AstNode<'a> for ImplItem<'a> { | 1299 | impl<'a> AstNode<'a> for ImplItem<'a> { |
998 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1300 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
999 | match syntax.kind() { | 1301 | match syntax.kind() { |
@@ -1017,12 +1319,20 @@ impl<R: TreeRoot<RaTypes>> ImplItemNode<R> { | |||
1017 | impl<'a> ImplItem<'a> {} | 1319 | impl<'a> ImplItem<'a> {} |
1018 | 1320 | ||
1019 | // ImplTraitType | 1321 | // ImplTraitType |
1020 | #[derive(Debug, Clone, Copy)] | 1322 | #[derive(Debug, Clone, Copy,)] |
1021 | pub struct ImplTraitTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1323 | pub struct ImplTraitTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1022 | syntax: SyntaxNode<R>, | 1324 | pub(crate) syntax: SyntaxNode<R>, |
1023 | } | 1325 | } |
1024 | pub type ImplTraitType<'a> = ImplTraitTypeNode<RefRoot<'a>>; | 1326 | pub type ImplTraitType<'a> = ImplTraitTypeNode<RefRoot<'a>>; |
1025 | 1327 | ||
1328 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ImplTraitTypeNode<R1>> for ImplTraitTypeNode<R2> { | ||
1329 | fn eq(&self, other: &ImplTraitTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
1330 | } | ||
1331 | impl<R: TreeRoot<RaTypes>> Eq for ImplTraitTypeNode<R> {} | ||
1332 | impl<R: TreeRoot<RaTypes>> Hash for ImplTraitTypeNode<R> { | ||
1333 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1334 | } | ||
1335 | |||
1026 | impl<'a> AstNode<'a> for ImplTraitType<'a> { | 1336 | impl<'a> AstNode<'a> for ImplTraitType<'a> { |
1027 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1337 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1028 | match syntax.kind() { | 1338 | match syntax.kind() { |
@@ -1046,12 +1356,20 @@ impl<R: TreeRoot<RaTypes>> ImplTraitTypeNode<R> { | |||
1046 | impl<'a> ImplTraitType<'a> {} | 1356 | impl<'a> ImplTraitType<'a> {} |
1047 | 1357 | ||
1048 | // IndexExpr | 1358 | // IndexExpr |
1049 | #[derive(Debug, Clone, Copy)] | 1359 | #[derive(Debug, Clone, Copy,)] |
1050 | pub struct IndexExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1360 | pub struct IndexExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1051 | syntax: SyntaxNode<R>, | 1361 | pub(crate) syntax: SyntaxNode<R>, |
1052 | } | 1362 | } |
1053 | pub type IndexExpr<'a> = IndexExprNode<RefRoot<'a>>; | 1363 | pub type IndexExpr<'a> = IndexExprNode<RefRoot<'a>>; |
1054 | 1364 | ||
1365 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<IndexExprNode<R1>> for IndexExprNode<R2> { | ||
1366 | fn eq(&self, other: &IndexExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
1367 | } | ||
1368 | impl<R: TreeRoot<RaTypes>> Eq for IndexExprNode<R> {} | ||
1369 | impl<R: TreeRoot<RaTypes>> Hash for IndexExprNode<R> { | ||
1370 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1371 | } | ||
1372 | |||
1055 | impl<'a> AstNode<'a> for IndexExpr<'a> { | 1373 | impl<'a> AstNode<'a> for IndexExpr<'a> { |
1056 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1374 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1057 | match syntax.kind() { | 1375 | match syntax.kind() { |
@@ -1075,12 +1393,20 @@ impl<R: TreeRoot<RaTypes>> IndexExprNode<R> { | |||
1075 | impl<'a> IndexExpr<'a> {} | 1393 | impl<'a> IndexExpr<'a> {} |
1076 | 1394 | ||
1077 | // ItemList | 1395 | // ItemList |
1078 | #[derive(Debug, Clone, Copy)] | 1396 | #[derive(Debug, Clone, Copy,)] |
1079 | pub struct ItemListNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1397 | pub struct ItemListNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1080 | syntax: SyntaxNode<R>, | 1398 | pub(crate) syntax: SyntaxNode<R>, |
1081 | } | 1399 | } |
1082 | pub type ItemList<'a> = ItemListNode<RefRoot<'a>>; | 1400 | pub type ItemList<'a> = ItemListNode<RefRoot<'a>>; |
1083 | 1401 | ||
1402 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ItemListNode<R1>> for ItemListNode<R2> { | ||
1403 | fn eq(&self, other: &ItemListNode<R1>) -> bool { self.syntax == other.syntax } | ||
1404 | } | ||
1405 | impl<R: TreeRoot<RaTypes>> Eq for ItemListNode<R> {} | ||
1406 | impl<R: TreeRoot<RaTypes>> Hash for ItemListNode<R> { | ||
1407 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1408 | } | ||
1409 | |||
1084 | impl<'a> AstNode<'a> for ItemList<'a> { | 1410 | impl<'a> AstNode<'a> for ItemList<'a> { |
1085 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1411 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1086 | match syntax.kind() { | 1412 | match syntax.kind() { |
@@ -1106,12 +1432,20 @@ impl<'a> ast::ModuleItemOwner<'a> for ItemList<'a> {} | |||
1106 | impl<'a> ItemList<'a> {} | 1432 | impl<'a> ItemList<'a> {} |
1107 | 1433 | ||
1108 | // Label | 1434 | // Label |
1109 | #[derive(Debug, Clone, Copy)] | 1435 | #[derive(Debug, Clone, Copy,)] |
1110 | pub struct LabelNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1436 | pub struct LabelNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1111 | syntax: SyntaxNode<R>, | 1437 | pub(crate) syntax: SyntaxNode<R>, |
1112 | } | 1438 | } |
1113 | pub type Label<'a> = LabelNode<RefRoot<'a>>; | 1439 | pub type Label<'a> = LabelNode<RefRoot<'a>>; |
1114 | 1440 | ||
1441 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LabelNode<R1>> for LabelNode<R2> { | ||
1442 | fn eq(&self, other: &LabelNode<R1>) -> bool { self.syntax == other.syntax } | ||
1443 | } | ||
1444 | impl<R: TreeRoot<RaTypes>> Eq for LabelNode<R> {} | ||
1445 | impl<R: TreeRoot<RaTypes>> Hash for LabelNode<R> { | ||
1446 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1447 | } | ||
1448 | |||
1115 | impl<'a> AstNode<'a> for Label<'a> { | 1449 | impl<'a> AstNode<'a> for Label<'a> { |
1116 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1450 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1117 | match syntax.kind() { | 1451 | match syntax.kind() { |
@@ -1135,12 +1469,20 @@ impl<R: TreeRoot<RaTypes>> LabelNode<R> { | |||
1135 | impl<'a> Label<'a> {} | 1469 | impl<'a> Label<'a> {} |
1136 | 1470 | ||
1137 | // LambdaExpr | 1471 | // LambdaExpr |
1138 | #[derive(Debug, Clone, Copy)] | 1472 | #[derive(Debug, Clone, Copy,)] |
1139 | pub struct LambdaExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1473 | pub struct LambdaExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1140 | syntax: SyntaxNode<R>, | 1474 | pub(crate) syntax: SyntaxNode<R>, |
1141 | } | 1475 | } |
1142 | pub type LambdaExpr<'a> = LambdaExprNode<RefRoot<'a>>; | 1476 | pub type LambdaExpr<'a> = LambdaExprNode<RefRoot<'a>>; |
1143 | 1477 | ||
1478 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LambdaExprNode<R1>> for LambdaExprNode<R2> { | ||
1479 | fn eq(&self, other: &LambdaExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
1480 | } | ||
1481 | impl<R: TreeRoot<RaTypes>> Eq for LambdaExprNode<R> {} | ||
1482 | impl<R: TreeRoot<RaTypes>> Hash for LambdaExprNode<R> { | ||
1483 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1484 | } | ||
1485 | |||
1144 | impl<'a> AstNode<'a> for LambdaExpr<'a> { | 1486 | impl<'a> AstNode<'a> for LambdaExpr<'a> { |
1145 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1487 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1146 | match syntax.kind() { | 1488 | match syntax.kind() { |
@@ -1172,12 +1514,20 @@ impl<'a> LambdaExpr<'a> { | |||
1172 | } | 1514 | } |
1173 | 1515 | ||
1174 | // LetStmt | 1516 | // LetStmt |
1175 | #[derive(Debug, Clone, Copy)] | 1517 | #[derive(Debug, Clone, Copy,)] |
1176 | pub struct LetStmtNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1518 | pub struct LetStmtNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1177 | syntax: SyntaxNode<R>, | 1519 | pub(crate) syntax: SyntaxNode<R>, |
1178 | } | 1520 | } |
1179 | pub type LetStmt<'a> = LetStmtNode<RefRoot<'a>>; | 1521 | pub type LetStmt<'a> = LetStmtNode<RefRoot<'a>>; |
1180 | 1522 | ||
1523 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LetStmtNode<R1>> for LetStmtNode<R2> { | ||
1524 | fn eq(&self, other: &LetStmtNode<R1>) -> bool { self.syntax == other.syntax } | ||
1525 | } | ||
1526 | impl<R: TreeRoot<RaTypes>> Eq for LetStmtNode<R> {} | ||
1527 | impl<R: TreeRoot<RaTypes>> Hash for LetStmtNode<R> { | ||
1528 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1529 | } | ||
1530 | |||
1181 | impl<'a> AstNode<'a> for LetStmt<'a> { | 1531 | impl<'a> AstNode<'a> for LetStmt<'a> { |
1182 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1532 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1183 | match syntax.kind() { | 1533 | match syntax.kind() { |
@@ -1209,12 +1559,20 @@ impl<'a> LetStmt<'a> { | |||
1209 | } | 1559 | } |
1210 | 1560 | ||
1211 | // Lifetime | 1561 | // Lifetime |
1212 | #[derive(Debug, Clone, Copy)] | 1562 | #[derive(Debug, Clone, Copy,)] |
1213 | pub struct LifetimeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1563 | pub struct LifetimeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1214 | syntax: SyntaxNode<R>, | 1564 | pub(crate) syntax: SyntaxNode<R>, |
1215 | } | 1565 | } |
1216 | pub type Lifetime<'a> = LifetimeNode<RefRoot<'a>>; | 1566 | pub type Lifetime<'a> = LifetimeNode<RefRoot<'a>>; |
1217 | 1567 | ||
1568 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LifetimeNode<R1>> for LifetimeNode<R2> { | ||
1569 | fn eq(&self, other: &LifetimeNode<R1>) -> bool { self.syntax == other.syntax } | ||
1570 | } | ||
1571 | impl<R: TreeRoot<RaTypes>> Eq for LifetimeNode<R> {} | ||
1572 | impl<R: TreeRoot<RaTypes>> Hash for LifetimeNode<R> { | ||
1573 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1574 | } | ||
1575 | |||
1218 | impl<'a> AstNode<'a> for Lifetime<'a> { | 1576 | impl<'a> AstNode<'a> for Lifetime<'a> { |
1219 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1577 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1220 | match syntax.kind() { | 1578 | match syntax.kind() { |
@@ -1238,12 +1596,20 @@ impl<R: TreeRoot<RaTypes>> LifetimeNode<R> { | |||
1238 | impl<'a> Lifetime<'a> {} | 1596 | impl<'a> Lifetime<'a> {} |
1239 | 1597 | ||
1240 | // LifetimeParam | 1598 | // LifetimeParam |
1241 | #[derive(Debug, Clone, Copy)] | 1599 | #[derive(Debug, Clone, Copy,)] |
1242 | pub struct LifetimeParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1600 | pub struct LifetimeParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1243 | syntax: SyntaxNode<R>, | 1601 | pub(crate) syntax: SyntaxNode<R>, |
1244 | } | 1602 | } |
1245 | pub type LifetimeParam<'a> = LifetimeParamNode<RefRoot<'a>>; | 1603 | pub type LifetimeParam<'a> = LifetimeParamNode<RefRoot<'a>>; |
1246 | 1604 | ||
1605 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LifetimeParamNode<R1>> for LifetimeParamNode<R2> { | ||
1606 | fn eq(&self, other: &LifetimeParamNode<R1>) -> bool { self.syntax == other.syntax } | ||
1607 | } | ||
1608 | impl<R: TreeRoot<RaTypes>> Eq for LifetimeParamNode<R> {} | ||
1609 | impl<R: TreeRoot<RaTypes>> Hash for LifetimeParamNode<R> { | ||
1610 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1611 | } | ||
1612 | |||
1247 | impl<'a> AstNode<'a> for LifetimeParam<'a> { | 1613 | impl<'a> AstNode<'a> for LifetimeParam<'a> { |
1248 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1614 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1249 | match syntax.kind() { | 1615 | match syntax.kind() { |
@@ -1271,12 +1637,20 @@ impl<'a> LifetimeParam<'a> { | |||
1271 | } | 1637 | } |
1272 | 1638 | ||
1273 | // Literal | 1639 | // Literal |
1274 | #[derive(Debug, Clone, Copy)] | 1640 | #[derive(Debug, Clone, Copy,)] |
1275 | pub struct LiteralNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1641 | pub struct LiteralNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1276 | syntax: SyntaxNode<R>, | 1642 | pub(crate) syntax: SyntaxNode<R>, |
1277 | } | 1643 | } |
1278 | pub type Literal<'a> = LiteralNode<RefRoot<'a>>; | 1644 | pub type Literal<'a> = LiteralNode<RefRoot<'a>>; |
1279 | 1645 | ||
1646 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LiteralNode<R1>> for LiteralNode<R2> { | ||
1647 | fn eq(&self, other: &LiteralNode<R1>) -> bool { self.syntax == other.syntax } | ||
1648 | } | ||
1649 | impl<R: TreeRoot<RaTypes>> Eq for LiteralNode<R> {} | ||
1650 | impl<R: TreeRoot<RaTypes>> Hash for LiteralNode<R> { | ||
1651 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1652 | } | ||
1653 | |||
1280 | impl<'a> AstNode<'a> for Literal<'a> { | 1654 | impl<'a> AstNode<'a> for Literal<'a> { |
1281 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1655 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1282 | match syntax.kind() { | 1656 | match syntax.kind() { |
@@ -1300,12 +1674,20 @@ impl<R: TreeRoot<RaTypes>> LiteralNode<R> { | |||
1300 | impl<'a> Literal<'a> {} | 1674 | impl<'a> Literal<'a> {} |
1301 | 1675 | ||
1302 | // LoopExpr | 1676 | // LoopExpr |
1303 | #[derive(Debug, Clone, Copy)] | 1677 | #[derive(Debug, Clone, Copy,)] |
1304 | pub struct LoopExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1678 | pub struct LoopExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1305 | syntax: SyntaxNode<R>, | 1679 | pub(crate) syntax: SyntaxNode<R>, |
1306 | } | 1680 | } |
1307 | pub type LoopExpr<'a> = LoopExprNode<RefRoot<'a>>; | 1681 | pub type LoopExpr<'a> = LoopExprNode<RefRoot<'a>>; |
1308 | 1682 | ||
1683 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LoopExprNode<R1>> for LoopExprNode<R2> { | ||
1684 | fn eq(&self, other: &LoopExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
1685 | } | ||
1686 | impl<R: TreeRoot<RaTypes>> Eq for LoopExprNode<R> {} | ||
1687 | impl<R: TreeRoot<RaTypes>> Hash for LoopExprNode<R> { | ||
1688 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1689 | } | ||
1690 | |||
1309 | impl<'a> AstNode<'a> for LoopExpr<'a> { | 1691 | impl<'a> AstNode<'a> for LoopExpr<'a> { |
1310 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1692 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1311 | match syntax.kind() { | 1693 | match syntax.kind() { |
@@ -1330,12 +1712,20 @@ impl<'a> ast::LoopBodyOwner<'a> for LoopExpr<'a> {} | |||
1330 | impl<'a> LoopExpr<'a> {} | 1712 | impl<'a> LoopExpr<'a> {} |
1331 | 1713 | ||
1332 | // MatchArm | 1714 | // MatchArm |
1333 | #[derive(Debug, Clone, Copy)] | 1715 | #[derive(Debug, Clone, Copy,)] |
1334 | pub struct MatchArmNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1716 | pub struct MatchArmNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1335 | syntax: SyntaxNode<R>, | 1717 | pub(crate) syntax: SyntaxNode<R>, |
1336 | } | 1718 | } |
1337 | pub type MatchArm<'a> = MatchArmNode<RefRoot<'a>>; | 1719 | pub type MatchArm<'a> = MatchArmNode<RefRoot<'a>>; |
1338 | 1720 | ||
1721 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MatchArmNode<R1>> for MatchArmNode<R2> { | ||
1722 | fn eq(&self, other: &MatchArmNode<R1>) -> bool { self.syntax == other.syntax } | ||
1723 | } | ||
1724 | impl<R: TreeRoot<RaTypes>> Eq for MatchArmNode<R> {} | ||
1725 | impl<R: TreeRoot<RaTypes>> Hash for MatchArmNode<R> { | ||
1726 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1727 | } | ||
1728 | |||
1339 | impl<'a> AstNode<'a> for MatchArm<'a> { | 1729 | impl<'a> AstNode<'a> for MatchArm<'a> { |
1340 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1730 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1341 | match syntax.kind() { | 1731 | match syntax.kind() { |
@@ -1371,12 +1761,20 @@ impl<'a> MatchArm<'a> { | |||
1371 | } | 1761 | } |
1372 | 1762 | ||
1373 | // MatchArmList | 1763 | // MatchArmList |
1374 | #[derive(Debug, Clone, Copy)] | 1764 | #[derive(Debug, Clone, Copy,)] |
1375 | pub struct MatchArmListNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1765 | pub struct MatchArmListNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1376 | syntax: SyntaxNode<R>, | 1766 | pub(crate) syntax: SyntaxNode<R>, |
1377 | } | 1767 | } |
1378 | pub type MatchArmList<'a> = MatchArmListNode<RefRoot<'a>>; | 1768 | pub type MatchArmList<'a> = MatchArmListNode<RefRoot<'a>>; |
1379 | 1769 | ||
1770 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MatchArmListNode<R1>> for MatchArmListNode<R2> { | ||
1771 | fn eq(&self, other: &MatchArmListNode<R1>) -> bool { self.syntax == other.syntax } | ||
1772 | } | ||
1773 | impl<R: TreeRoot<RaTypes>> Eq for MatchArmListNode<R> {} | ||
1774 | impl<R: TreeRoot<RaTypes>> Hash for MatchArmListNode<R> { | ||
1775 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1776 | } | ||
1777 | |||
1380 | impl<'a> AstNode<'a> for MatchArmList<'a> { | 1778 | impl<'a> AstNode<'a> for MatchArmList<'a> { |
1381 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1779 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1382 | match syntax.kind() { | 1780 | match syntax.kind() { |
@@ -1404,12 +1802,20 @@ impl<'a> MatchArmList<'a> { | |||
1404 | } | 1802 | } |
1405 | 1803 | ||
1406 | // MatchExpr | 1804 | // MatchExpr |
1407 | #[derive(Debug, Clone, Copy)] | 1805 | #[derive(Debug, Clone, Copy,)] |
1408 | pub struct MatchExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1806 | pub struct MatchExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1409 | syntax: SyntaxNode<R>, | 1807 | pub(crate) syntax: SyntaxNode<R>, |
1410 | } | 1808 | } |
1411 | pub type MatchExpr<'a> = MatchExprNode<RefRoot<'a>>; | 1809 | pub type MatchExpr<'a> = MatchExprNode<RefRoot<'a>>; |
1412 | 1810 | ||
1811 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MatchExprNode<R1>> for MatchExprNode<R2> { | ||
1812 | fn eq(&self, other: &MatchExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
1813 | } | ||
1814 | impl<R: TreeRoot<RaTypes>> Eq for MatchExprNode<R> {} | ||
1815 | impl<R: TreeRoot<RaTypes>> Hash for MatchExprNode<R> { | ||
1816 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1817 | } | ||
1818 | |||
1413 | impl<'a> AstNode<'a> for MatchExpr<'a> { | 1819 | impl<'a> AstNode<'a> for MatchExpr<'a> { |
1414 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1820 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1415 | match syntax.kind() { | 1821 | match syntax.kind() { |
@@ -1441,12 +1847,20 @@ impl<'a> MatchExpr<'a> { | |||
1441 | } | 1847 | } |
1442 | 1848 | ||
1443 | // MatchGuard | 1849 | // MatchGuard |
1444 | #[derive(Debug, Clone, Copy)] | 1850 | #[derive(Debug, Clone, Copy,)] |
1445 | pub struct MatchGuardNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1851 | pub struct MatchGuardNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1446 | syntax: SyntaxNode<R>, | 1852 | pub(crate) syntax: SyntaxNode<R>, |
1447 | } | 1853 | } |
1448 | pub type MatchGuard<'a> = MatchGuardNode<RefRoot<'a>>; | 1854 | pub type MatchGuard<'a> = MatchGuardNode<RefRoot<'a>>; |
1449 | 1855 | ||
1856 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MatchGuardNode<R1>> for MatchGuardNode<R2> { | ||
1857 | fn eq(&self, other: &MatchGuardNode<R1>) -> bool { self.syntax == other.syntax } | ||
1858 | } | ||
1859 | impl<R: TreeRoot<RaTypes>> Eq for MatchGuardNode<R> {} | ||
1860 | impl<R: TreeRoot<RaTypes>> Hash for MatchGuardNode<R> { | ||
1861 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1862 | } | ||
1863 | |||
1450 | impl<'a> AstNode<'a> for MatchGuard<'a> { | 1864 | impl<'a> AstNode<'a> for MatchGuard<'a> { |
1451 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1865 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1452 | match syntax.kind() { | 1866 | match syntax.kind() { |
@@ -1470,12 +1884,20 @@ impl<R: TreeRoot<RaTypes>> MatchGuardNode<R> { | |||
1470 | impl<'a> MatchGuard<'a> {} | 1884 | impl<'a> MatchGuard<'a> {} |
1471 | 1885 | ||
1472 | // MethodCallExpr | 1886 | // MethodCallExpr |
1473 | #[derive(Debug, Clone, Copy)] | 1887 | #[derive(Debug, Clone, Copy,)] |
1474 | pub struct MethodCallExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1888 | pub struct MethodCallExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1475 | syntax: SyntaxNode<R>, | 1889 | pub(crate) syntax: SyntaxNode<R>, |
1476 | } | 1890 | } |
1477 | pub type MethodCallExpr<'a> = MethodCallExprNode<RefRoot<'a>>; | 1891 | pub type MethodCallExpr<'a> = MethodCallExprNode<RefRoot<'a>>; |
1478 | 1892 | ||
1893 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MethodCallExprNode<R1>> for MethodCallExprNode<R2> { | ||
1894 | fn eq(&self, other: &MethodCallExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
1895 | } | ||
1896 | impl<R: TreeRoot<RaTypes>> Eq for MethodCallExprNode<R> {} | ||
1897 | impl<R: TreeRoot<RaTypes>> Hash for MethodCallExprNode<R> { | ||
1898 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1899 | } | ||
1900 | |||
1479 | impl<'a> AstNode<'a> for MethodCallExpr<'a> { | 1901 | impl<'a> AstNode<'a> for MethodCallExpr<'a> { |
1480 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1902 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1481 | match syntax.kind() { | 1903 | match syntax.kind() { |
@@ -1504,12 +1926,20 @@ impl<'a> MethodCallExpr<'a> { | |||
1504 | } | 1926 | } |
1505 | 1927 | ||
1506 | // Module | 1928 | // Module |
1507 | #[derive(Debug, Clone, Copy)] | 1929 | #[derive(Debug, Clone, Copy,)] |
1508 | pub struct ModuleNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 1930 | pub struct ModuleNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1509 | syntax: SyntaxNode<R>, | 1931 | pub(crate) syntax: SyntaxNode<R>, |
1510 | } | 1932 | } |
1511 | pub type Module<'a> = ModuleNode<RefRoot<'a>>; | 1933 | pub type Module<'a> = ModuleNode<RefRoot<'a>>; |
1512 | 1934 | ||
1935 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ModuleNode<R1>> for ModuleNode<R2> { | ||
1936 | fn eq(&self, other: &ModuleNode<R1>) -> bool { self.syntax == other.syntax } | ||
1937 | } | ||
1938 | impl<R: TreeRoot<RaTypes>> Eq for ModuleNode<R> {} | ||
1939 | impl<R: TreeRoot<RaTypes>> Hash for ModuleNode<R> { | ||
1940 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
1941 | } | ||
1942 | |||
1513 | impl<'a> AstNode<'a> for Module<'a> { | 1943 | impl<'a> AstNode<'a> for Module<'a> { |
1514 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 1944 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1515 | match syntax.kind() { | 1945 | match syntax.kind() { |
@@ -1532,6 +1962,7 @@ impl<R: TreeRoot<RaTypes>> ModuleNode<R> { | |||
1532 | 1962 | ||
1533 | impl<'a> ast::NameOwner<'a> for Module<'a> {} | 1963 | impl<'a> ast::NameOwner<'a> for Module<'a> {} |
1534 | impl<'a> ast::AttrsOwner<'a> for Module<'a> {} | 1964 | impl<'a> ast::AttrsOwner<'a> for Module<'a> {} |
1965 | impl<'a> ast::DocCommentsOwner<'a> for Module<'a> {} | ||
1535 | impl<'a> Module<'a> { | 1966 | impl<'a> Module<'a> { |
1536 | pub fn item_list(self) -> Option<ItemList<'a>> { | 1967 | pub fn item_list(self) -> Option<ItemList<'a>> { |
1537 | super::child_opt(self) | 1968 | super::child_opt(self) |
@@ -1539,7 +1970,7 @@ impl<'a> Module<'a> { | |||
1539 | } | 1970 | } |
1540 | 1971 | ||
1541 | // ModuleItem | 1972 | // ModuleItem |
1542 | #[derive(Debug, Clone, Copy)] | 1973 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
1543 | pub enum ModuleItem<'a> { | 1974 | pub enum ModuleItem<'a> { |
1544 | StructDef(StructDef<'a>), | 1975 | StructDef(StructDef<'a>), |
1545 | EnumDef(EnumDef<'a>), | 1976 | EnumDef(EnumDef<'a>), |
@@ -1591,12 +2022,20 @@ impl<'a> AstNode<'a> for ModuleItem<'a> { | |||
1591 | impl<'a> ModuleItem<'a> {} | 2022 | impl<'a> ModuleItem<'a> {} |
1592 | 2023 | ||
1593 | // Name | 2024 | // Name |
1594 | #[derive(Debug, Clone, Copy)] | 2025 | #[derive(Debug, Clone, Copy,)] |
1595 | pub struct NameNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2026 | pub struct NameNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1596 | syntax: SyntaxNode<R>, | 2027 | pub(crate) syntax: SyntaxNode<R>, |
1597 | } | 2028 | } |
1598 | pub type Name<'a> = NameNode<RefRoot<'a>>; | 2029 | pub type Name<'a> = NameNode<RefRoot<'a>>; |
1599 | 2030 | ||
2031 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NameNode<R1>> for NameNode<R2> { | ||
2032 | fn eq(&self, other: &NameNode<R1>) -> bool { self.syntax == other.syntax } | ||
2033 | } | ||
2034 | impl<R: TreeRoot<RaTypes>> Eq for NameNode<R> {} | ||
2035 | impl<R: TreeRoot<RaTypes>> Hash for NameNode<R> { | ||
2036 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2037 | } | ||
2038 | |||
1600 | impl<'a> AstNode<'a> for Name<'a> { | 2039 | impl<'a> AstNode<'a> for Name<'a> { |
1601 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2040 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1602 | match syntax.kind() { | 2041 | match syntax.kind() { |
@@ -1620,12 +2059,20 @@ impl<R: TreeRoot<RaTypes>> NameNode<R> { | |||
1620 | impl<'a> Name<'a> {} | 2059 | impl<'a> Name<'a> {} |
1621 | 2060 | ||
1622 | // NameRef | 2061 | // NameRef |
1623 | #[derive(Debug, Clone, Copy)] | 2062 | #[derive(Debug, Clone, Copy,)] |
1624 | pub struct NameRefNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2063 | pub struct NameRefNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1625 | syntax: SyntaxNode<R>, | 2064 | pub(crate) syntax: SyntaxNode<R>, |
1626 | } | 2065 | } |
1627 | pub type NameRef<'a> = NameRefNode<RefRoot<'a>>; | 2066 | pub type NameRef<'a> = NameRefNode<RefRoot<'a>>; |
1628 | 2067 | ||
2068 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NameRefNode<R1>> for NameRefNode<R2> { | ||
2069 | fn eq(&self, other: &NameRefNode<R1>) -> bool { self.syntax == other.syntax } | ||
2070 | } | ||
2071 | impl<R: TreeRoot<RaTypes>> Eq for NameRefNode<R> {} | ||
2072 | impl<R: TreeRoot<RaTypes>> Hash for NameRefNode<R> { | ||
2073 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2074 | } | ||
2075 | |||
1629 | impl<'a> AstNode<'a> for NameRef<'a> { | 2076 | impl<'a> AstNode<'a> for NameRef<'a> { |
1630 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2077 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1631 | match syntax.kind() { | 2078 | match syntax.kind() { |
@@ -1649,12 +2096,20 @@ impl<R: TreeRoot<RaTypes>> NameRefNode<R> { | |||
1649 | impl<'a> NameRef<'a> {} | 2096 | impl<'a> NameRef<'a> {} |
1650 | 2097 | ||
1651 | // NamedField | 2098 | // NamedField |
1652 | #[derive(Debug, Clone, Copy)] | 2099 | #[derive(Debug, Clone, Copy,)] |
1653 | pub struct NamedFieldNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2100 | pub struct NamedFieldNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1654 | syntax: SyntaxNode<R>, | 2101 | pub(crate) syntax: SyntaxNode<R>, |
1655 | } | 2102 | } |
1656 | pub type NamedField<'a> = NamedFieldNode<RefRoot<'a>>; | 2103 | pub type NamedField<'a> = NamedFieldNode<RefRoot<'a>>; |
1657 | 2104 | ||
2105 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NamedFieldNode<R1>> for NamedFieldNode<R2> { | ||
2106 | fn eq(&self, other: &NamedFieldNode<R1>) -> bool { self.syntax == other.syntax } | ||
2107 | } | ||
2108 | impl<R: TreeRoot<RaTypes>> Eq for NamedFieldNode<R> {} | ||
2109 | impl<R: TreeRoot<RaTypes>> Hash for NamedFieldNode<R> { | ||
2110 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2111 | } | ||
2112 | |||
1658 | impl<'a> AstNode<'a> for NamedField<'a> { | 2113 | impl<'a> AstNode<'a> for NamedField<'a> { |
1659 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2114 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1660 | match syntax.kind() { | 2115 | match syntax.kind() { |
@@ -1678,12 +2133,20 @@ impl<R: TreeRoot<RaTypes>> NamedFieldNode<R> { | |||
1678 | impl<'a> NamedField<'a> {} | 2133 | impl<'a> NamedField<'a> {} |
1679 | 2134 | ||
1680 | // NamedFieldDef | 2135 | // NamedFieldDef |
1681 | #[derive(Debug, Clone, Copy)] | 2136 | #[derive(Debug, Clone, Copy,)] |
1682 | pub struct NamedFieldDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2137 | pub struct NamedFieldDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1683 | syntax: SyntaxNode<R>, | 2138 | pub(crate) syntax: SyntaxNode<R>, |
1684 | } | 2139 | } |
1685 | pub type NamedFieldDef<'a> = NamedFieldDefNode<RefRoot<'a>>; | 2140 | pub type NamedFieldDef<'a> = NamedFieldDefNode<RefRoot<'a>>; |
1686 | 2141 | ||
2142 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NamedFieldDefNode<R1>> for NamedFieldDefNode<R2> { | ||
2143 | fn eq(&self, other: &NamedFieldDefNode<R1>) -> bool { self.syntax == other.syntax } | ||
2144 | } | ||
2145 | impl<R: TreeRoot<RaTypes>> Eq for NamedFieldDefNode<R> {} | ||
2146 | impl<R: TreeRoot<RaTypes>> Hash for NamedFieldDefNode<R> { | ||
2147 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2148 | } | ||
2149 | |||
1687 | impl<'a> AstNode<'a> for NamedFieldDef<'a> { | 2150 | impl<'a> AstNode<'a> for NamedFieldDef<'a> { |
1688 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2151 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1689 | match syntax.kind() { | 2152 | match syntax.kind() { |
@@ -1709,12 +2172,20 @@ impl<'a> ast::AttrsOwner<'a> for NamedFieldDef<'a> {} | |||
1709 | impl<'a> NamedFieldDef<'a> {} | 2172 | impl<'a> NamedFieldDef<'a> {} |
1710 | 2173 | ||
1711 | // NamedFieldList | 2174 | // NamedFieldList |
1712 | #[derive(Debug, Clone, Copy)] | 2175 | #[derive(Debug, Clone, Copy,)] |
1713 | pub struct NamedFieldListNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2176 | pub struct NamedFieldListNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1714 | syntax: SyntaxNode<R>, | 2177 | pub(crate) syntax: SyntaxNode<R>, |
1715 | } | 2178 | } |
1716 | pub type NamedFieldList<'a> = NamedFieldListNode<RefRoot<'a>>; | 2179 | pub type NamedFieldList<'a> = NamedFieldListNode<RefRoot<'a>>; |
1717 | 2180 | ||
2181 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NamedFieldListNode<R1>> for NamedFieldListNode<R2> { | ||
2182 | fn eq(&self, other: &NamedFieldListNode<R1>) -> bool { self.syntax == other.syntax } | ||
2183 | } | ||
2184 | impl<R: TreeRoot<RaTypes>> Eq for NamedFieldListNode<R> {} | ||
2185 | impl<R: TreeRoot<RaTypes>> Hash for NamedFieldListNode<R> { | ||
2186 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2187 | } | ||
2188 | |||
1718 | impl<'a> AstNode<'a> for NamedFieldList<'a> { | 2189 | impl<'a> AstNode<'a> for NamedFieldList<'a> { |
1719 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2190 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1720 | match syntax.kind() { | 2191 | match syntax.kind() { |
@@ -1738,12 +2209,20 @@ impl<R: TreeRoot<RaTypes>> NamedFieldListNode<R> { | |||
1738 | impl<'a> NamedFieldList<'a> {} | 2209 | impl<'a> NamedFieldList<'a> {} |
1739 | 2210 | ||
1740 | // NeverType | 2211 | // NeverType |
1741 | #[derive(Debug, Clone, Copy)] | 2212 | #[derive(Debug, Clone, Copy,)] |
1742 | pub struct NeverTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2213 | pub struct NeverTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1743 | syntax: SyntaxNode<R>, | 2214 | pub(crate) syntax: SyntaxNode<R>, |
1744 | } | 2215 | } |
1745 | pub type NeverType<'a> = NeverTypeNode<RefRoot<'a>>; | 2216 | pub type NeverType<'a> = NeverTypeNode<RefRoot<'a>>; |
1746 | 2217 | ||
2218 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NeverTypeNode<R1>> for NeverTypeNode<R2> { | ||
2219 | fn eq(&self, other: &NeverTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
2220 | } | ||
2221 | impl<R: TreeRoot<RaTypes>> Eq for NeverTypeNode<R> {} | ||
2222 | impl<R: TreeRoot<RaTypes>> Hash for NeverTypeNode<R> { | ||
2223 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2224 | } | ||
2225 | |||
1747 | impl<'a> AstNode<'a> for NeverType<'a> { | 2226 | impl<'a> AstNode<'a> for NeverType<'a> { |
1748 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2227 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1749 | match syntax.kind() { | 2228 | match syntax.kind() { |
@@ -1767,7 +2246,7 @@ impl<R: TreeRoot<RaTypes>> NeverTypeNode<R> { | |||
1767 | impl<'a> NeverType<'a> {} | 2246 | impl<'a> NeverType<'a> {} |
1768 | 2247 | ||
1769 | // NominalDef | 2248 | // NominalDef |
1770 | #[derive(Debug, Clone, Copy)] | 2249 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
1771 | pub enum NominalDef<'a> { | 2250 | pub enum NominalDef<'a> { |
1772 | StructDef(StructDef<'a>), | 2251 | StructDef(StructDef<'a>), |
1773 | EnumDef(EnumDef<'a>), | 2252 | EnumDef(EnumDef<'a>), |
@@ -1795,12 +2274,20 @@ impl<'a> ast::AttrsOwner<'a> for NominalDef<'a> {} | |||
1795 | impl<'a> NominalDef<'a> {} | 2274 | impl<'a> NominalDef<'a> {} |
1796 | 2275 | ||
1797 | // Param | 2276 | // Param |
1798 | #[derive(Debug, Clone, Copy)] | 2277 | #[derive(Debug, Clone, Copy,)] |
1799 | pub struct ParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2278 | pub struct ParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1800 | syntax: SyntaxNode<R>, | 2279 | pub(crate) syntax: SyntaxNode<R>, |
1801 | } | 2280 | } |
1802 | pub type Param<'a> = ParamNode<RefRoot<'a>>; | 2281 | pub type Param<'a> = ParamNode<RefRoot<'a>>; |
1803 | 2282 | ||
2283 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ParamNode<R1>> for ParamNode<R2> { | ||
2284 | fn eq(&self, other: &ParamNode<R1>) -> bool { self.syntax == other.syntax } | ||
2285 | } | ||
2286 | impl<R: TreeRoot<RaTypes>> Eq for ParamNode<R> {} | ||
2287 | impl<R: TreeRoot<RaTypes>> Hash for ParamNode<R> { | ||
2288 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2289 | } | ||
2290 | |||
1804 | impl<'a> AstNode<'a> for Param<'a> { | 2291 | impl<'a> AstNode<'a> for Param<'a> { |
1805 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2292 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1806 | match syntax.kind() { | 2293 | match syntax.kind() { |
@@ -1828,12 +2315,20 @@ impl<'a> Param<'a> { | |||
1828 | } | 2315 | } |
1829 | 2316 | ||
1830 | // ParamList | 2317 | // ParamList |
1831 | #[derive(Debug, Clone, Copy)] | 2318 | #[derive(Debug, Clone, Copy,)] |
1832 | pub struct ParamListNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2319 | pub struct ParamListNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1833 | syntax: SyntaxNode<R>, | 2320 | pub(crate) syntax: SyntaxNode<R>, |
1834 | } | 2321 | } |
1835 | pub type ParamList<'a> = ParamListNode<RefRoot<'a>>; | 2322 | pub type ParamList<'a> = ParamListNode<RefRoot<'a>>; |
1836 | 2323 | ||
2324 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ParamListNode<R1>> for ParamListNode<R2> { | ||
2325 | fn eq(&self, other: &ParamListNode<R1>) -> bool { self.syntax == other.syntax } | ||
2326 | } | ||
2327 | impl<R: TreeRoot<RaTypes>> Eq for ParamListNode<R> {} | ||
2328 | impl<R: TreeRoot<RaTypes>> Hash for ParamListNode<R> { | ||
2329 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2330 | } | ||
2331 | |||
1837 | impl<'a> AstNode<'a> for ParamList<'a> { | 2332 | impl<'a> AstNode<'a> for ParamList<'a> { |
1838 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2333 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1839 | match syntax.kind() { | 2334 | match syntax.kind() { |
@@ -1865,12 +2360,20 @@ impl<'a> ParamList<'a> { | |||
1865 | } | 2360 | } |
1866 | 2361 | ||
1867 | // ParenExpr | 2362 | // ParenExpr |
1868 | #[derive(Debug, Clone, Copy)] | 2363 | #[derive(Debug, Clone, Copy,)] |
1869 | pub struct ParenExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2364 | pub struct ParenExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1870 | syntax: SyntaxNode<R>, | 2365 | pub(crate) syntax: SyntaxNode<R>, |
1871 | } | 2366 | } |
1872 | pub type ParenExpr<'a> = ParenExprNode<RefRoot<'a>>; | 2367 | pub type ParenExpr<'a> = ParenExprNode<RefRoot<'a>>; |
1873 | 2368 | ||
2369 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ParenExprNode<R1>> for ParenExprNode<R2> { | ||
2370 | fn eq(&self, other: &ParenExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
2371 | } | ||
2372 | impl<R: TreeRoot<RaTypes>> Eq for ParenExprNode<R> {} | ||
2373 | impl<R: TreeRoot<RaTypes>> Hash for ParenExprNode<R> { | ||
2374 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2375 | } | ||
2376 | |||
1874 | impl<'a> AstNode<'a> for ParenExpr<'a> { | 2377 | impl<'a> AstNode<'a> for ParenExpr<'a> { |
1875 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2378 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1876 | match syntax.kind() { | 2379 | match syntax.kind() { |
@@ -1894,12 +2397,20 @@ impl<R: TreeRoot<RaTypes>> ParenExprNode<R> { | |||
1894 | impl<'a> ParenExpr<'a> {} | 2397 | impl<'a> ParenExpr<'a> {} |
1895 | 2398 | ||
1896 | // ParenType | 2399 | // ParenType |
1897 | #[derive(Debug, Clone, Copy)] | 2400 | #[derive(Debug, Clone, Copy,)] |
1898 | pub struct ParenTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2401 | pub struct ParenTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1899 | syntax: SyntaxNode<R>, | 2402 | pub(crate) syntax: SyntaxNode<R>, |
1900 | } | 2403 | } |
1901 | pub type ParenType<'a> = ParenTypeNode<RefRoot<'a>>; | 2404 | pub type ParenType<'a> = ParenTypeNode<RefRoot<'a>>; |
1902 | 2405 | ||
2406 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ParenTypeNode<R1>> for ParenTypeNode<R2> { | ||
2407 | fn eq(&self, other: &ParenTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
2408 | } | ||
2409 | impl<R: TreeRoot<RaTypes>> Eq for ParenTypeNode<R> {} | ||
2410 | impl<R: TreeRoot<RaTypes>> Hash for ParenTypeNode<R> { | ||
2411 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2412 | } | ||
2413 | |||
1903 | impl<'a> AstNode<'a> for ParenType<'a> { | 2414 | impl<'a> AstNode<'a> for ParenType<'a> { |
1904 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2415 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1905 | match syntax.kind() { | 2416 | match syntax.kind() { |
@@ -1923,7 +2434,7 @@ impl<R: TreeRoot<RaTypes>> ParenTypeNode<R> { | |||
1923 | impl<'a> ParenType<'a> {} | 2434 | impl<'a> ParenType<'a> {} |
1924 | 2435 | ||
1925 | // Pat | 2436 | // Pat |
1926 | #[derive(Debug, Clone, Copy)] | 2437 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
1927 | pub enum Pat<'a> { | 2438 | pub enum Pat<'a> { |
1928 | RefPat(RefPat<'a>), | 2439 | RefPat(RefPat<'a>), |
1929 | BindPat(BindPat<'a>), | 2440 | BindPat(BindPat<'a>), |
@@ -1972,12 +2483,20 @@ impl<'a> AstNode<'a> for Pat<'a> { | |||
1972 | impl<'a> Pat<'a> {} | 2483 | impl<'a> Pat<'a> {} |
1973 | 2484 | ||
1974 | // Path | 2485 | // Path |
1975 | #[derive(Debug, Clone, Copy)] | 2486 | #[derive(Debug, Clone, Copy,)] |
1976 | pub struct PathNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2487 | pub struct PathNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
1977 | syntax: SyntaxNode<R>, | 2488 | pub(crate) syntax: SyntaxNode<R>, |
1978 | } | 2489 | } |
1979 | pub type Path<'a> = PathNode<RefRoot<'a>>; | 2490 | pub type Path<'a> = PathNode<RefRoot<'a>>; |
1980 | 2491 | ||
2492 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathNode<R1>> for PathNode<R2> { | ||
2493 | fn eq(&self, other: &PathNode<R1>) -> bool { self.syntax == other.syntax } | ||
2494 | } | ||
2495 | impl<R: TreeRoot<RaTypes>> Eq for PathNode<R> {} | ||
2496 | impl<R: TreeRoot<RaTypes>> Hash for PathNode<R> { | ||
2497 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2498 | } | ||
2499 | |||
1981 | impl<'a> AstNode<'a> for Path<'a> { | 2500 | impl<'a> AstNode<'a> for Path<'a> { |
1982 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2501 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
1983 | match syntax.kind() { | 2502 | match syntax.kind() { |
@@ -2009,12 +2528,20 @@ impl<'a> Path<'a> { | |||
2009 | } | 2528 | } |
2010 | 2529 | ||
2011 | // PathExpr | 2530 | // PathExpr |
2012 | #[derive(Debug, Clone, Copy)] | 2531 | #[derive(Debug, Clone, Copy,)] |
2013 | pub struct PathExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2532 | pub struct PathExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2014 | syntax: SyntaxNode<R>, | 2533 | pub(crate) syntax: SyntaxNode<R>, |
2015 | } | 2534 | } |
2016 | pub type PathExpr<'a> = PathExprNode<RefRoot<'a>>; | 2535 | pub type PathExpr<'a> = PathExprNode<RefRoot<'a>>; |
2017 | 2536 | ||
2537 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathExprNode<R1>> for PathExprNode<R2> { | ||
2538 | fn eq(&self, other: &PathExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
2539 | } | ||
2540 | impl<R: TreeRoot<RaTypes>> Eq for PathExprNode<R> {} | ||
2541 | impl<R: TreeRoot<RaTypes>> Hash for PathExprNode<R> { | ||
2542 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2543 | } | ||
2544 | |||
2018 | impl<'a> AstNode<'a> for PathExpr<'a> { | 2545 | impl<'a> AstNode<'a> for PathExpr<'a> { |
2019 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2546 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2020 | match syntax.kind() { | 2547 | match syntax.kind() { |
@@ -2042,12 +2569,20 @@ impl<'a> PathExpr<'a> { | |||
2042 | } | 2569 | } |
2043 | 2570 | ||
2044 | // PathPat | 2571 | // PathPat |
2045 | #[derive(Debug, Clone, Copy)] | 2572 | #[derive(Debug, Clone, Copy,)] |
2046 | pub struct PathPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2573 | pub struct PathPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2047 | syntax: SyntaxNode<R>, | 2574 | pub(crate) syntax: SyntaxNode<R>, |
2048 | } | 2575 | } |
2049 | pub type PathPat<'a> = PathPatNode<RefRoot<'a>>; | 2576 | pub type PathPat<'a> = PathPatNode<RefRoot<'a>>; |
2050 | 2577 | ||
2578 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathPatNode<R1>> for PathPatNode<R2> { | ||
2579 | fn eq(&self, other: &PathPatNode<R1>) -> bool { self.syntax == other.syntax } | ||
2580 | } | ||
2581 | impl<R: TreeRoot<RaTypes>> Eq for PathPatNode<R> {} | ||
2582 | impl<R: TreeRoot<RaTypes>> Hash for PathPatNode<R> { | ||
2583 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2584 | } | ||
2585 | |||
2051 | impl<'a> AstNode<'a> for PathPat<'a> { | 2586 | impl<'a> AstNode<'a> for PathPat<'a> { |
2052 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2587 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2053 | match syntax.kind() { | 2588 | match syntax.kind() { |
@@ -2071,12 +2606,20 @@ impl<R: TreeRoot<RaTypes>> PathPatNode<R> { | |||
2071 | impl<'a> PathPat<'a> {} | 2606 | impl<'a> PathPat<'a> {} |
2072 | 2607 | ||
2073 | // PathSegment | 2608 | // PathSegment |
2074 | #[derive(Debug, Clone, Copy)] | 2609 | #[derive(Debug, Clone, Copy,)] |
2075 | pub struct PathSegmentNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2610 | pub struct PathSegmentNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2076 | syntax: SyntaxNode<R>, | 2611 | pub(crate) syntax: SyntaxNode<R>, |
2077 | } | 2612 | } |
2078 | pub type PathSegment<'a> = PathSegmentNode<RefRoot<'a>>; | 2613 | pub type PathSegment<'a> = PathSegmentNode<RefRoot<'a>>; |
2079 | 2614 | ||
2615 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathSegmentNode<R1>> for PathSegmentNode<R2> { | ||
2616 | fn eq(&self, other: &PathSegmentNode<R1>) -> bool { self.syntax == other.syntax } | ||
2617 | } | ||
2618 | impl<R: TreeRoot<RaTypes>> Eq for PathSegmentNode<R> {} | ||
2619 | impl<R: TreeRoot<RaTypes>> Hash for PathSegmentNode<R> { | ||
2620 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2621 | } | ||
2622 | |||
2080 | impl<'a> AstNode<'a> for PathSegment<'a> { | 2623 | impl<'a> AstNode<'a> for PathSegment<'a> { |
2081 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2624 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2082 | match syntax.kind() { | 2625 | match syntax.kind() { |
@@ -2104,12 +2647,20 @@ impl<'a> PathSegment<'a> { | |||
2104 | } | 2647 | } |
2105 | 2648 | ||
2106 | // PathType | 2649 | // PathType |
2107 | #[derive(Debug, Clone, Copy)] | 2650 | #[derive(Debug, Clone, Copy,)] |
2108 | pub struct PathTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2651 | pub struct PathTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2109 | syntax: SyntaxNode<R>, | 2652 | pub(crate) syntax: SyntaxNode<R>, |
2110 | } | 2653 | } |
2111 | pub type PathType<'a> = PathTypeNode<RefRoot<'a>>; | 2654 | pub type PathType<'a> = PathTypeNode<RefRoot<'a>>; |
2112 | 2655 | ||
2656 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathTypeNode<R1>> for PathTypeNode<R2> { | ||
2657 | fn eq(&self, other: &PathTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
2658 | } | ||
2659 | impl<R: TreeRoot<RaTypes>> Eq for PathTypeNode<R> {} | ||
2660 | impl<R: TreeRoot<RaTypes>> Hash for PathTypeNode<R> { | ||
2661 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2662 | } | ||
2663 | |||
2113 | impl<'a> AstNode<'a> for PathType<'a> { | 2664 | impl<'a> AstNode<'a> for PathType<'a> { |
2114 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2665 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2115 | match syntax.kind() { | 2666 | match syntax.kind() { |
@@ -2133,12 +2684,20 @@ impl<R: TreeRoot<RaTypes>> PathTypeNode<R> { | |||
2133 | impl<'a> PathType<'a> {} | 2684 | impl<'a> PathType<'a> {} |
2134 | 2685 | ||
2135 | // PlaceholderPat | 2686 | // PlaceholderPat |
2136 | #[derive(Debug, Clone, Copy)] | 2687 | #[derive(Debug, Clone, Copy,)] |
2137 | pub struct PlaceholderPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2688 | pub struct PlaceholderPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2138 | syntax: SyntaxNode<R>, | 2689 | pub(crate) syntax: SyntaxNode<R>, |
2139 | } | 2690 | } |
2140 | pub type PlaceholderPat<'a> = PlaceholderPatNode<RefRoot<'a>>; | 2691 | pub type PlaceholderPat<'a> = PlaceholderPatNode<RefRoot<'a>>; |
2141 | 2692 | ||
2693 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PlaceholderPatNode<R1>> for PlaceholderPatNode<R2> { | ||
2694 | fn eq(&self, other: &PlaceholderPatNode<R1>) -> bool { self.syntax == other.syntax } | ||
2695 | } | ||
2696 | impl<R: TreeRoot<RaTypes>> Eq for PlaceholderPatNode<R> {} | ||
2697 | impl<R: TreeRoot<RaTypes>> Hash for PlaceholderPatNode<R> { | ||
2698 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2699 | } | ||
2700 | |||
2142 | impl<'a> AstNode<'a> for PlaceholderPat<'a> { | 2701 | impl<'a> AstNode<'a> for PlaceholderPat<'a> { |
2143 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2702 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2144 | match syntax.kind() { | 2703 | match syntax.kind() { |
@@ -2162,12 +2721,20 @@ impl<R: TreeRoot<RaTypes>> PlaceholderPatNode<R> { | |||
2162 | impl<'a> PlaceholderPat<'a> {} | 2721 | impl<'a> PlaceholderPat<'a> {} |
2163 | 2722 | ||
2164 | // PlaceholderType | 2723 | // PlaceholderType |
2165 | #[derive(Debug, Clone, Copy)] | 2724 | #[derive(Debug, Clone, Copy,)] |
2166 | pub struct PlaceholderTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2725 | pub struct PlaceholderTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2167 | syntax: SyntaxNode<R>, | 2726 | pub(crate) syntax: SyntaxNode<R>, |
2168 | } | 2727 | } |
2169 | pub type PlaceholderType<'a> = PlaceholderTypeNode<RefRoot<'a>>; | 2728 | pub type PlaceholderType<'a> = PlaceholderTypeNode<RefRoot<'a>>; |
2170 | 2729 | ||
2730 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PlaceholderTypeNode<R1>> for PlaceholderTypeNode<R2> { | ||
2731 | fn eq(&self, other: &PlaceholderTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
2732 | } | ||
2733 | impl<R: TreeRoot<RaTypes>> Eq for PlaceholderTypeNode<R> {} | ||
2734 | impl<R: TreeRoot<RaTypes>> Hash for PlaceholderTypeNode<R> { | ||
2735 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2736 | } | ||
2737 | |||
2171 | impl<'a> AstNode<'a> for PlaceholderType<'a> { | 2738 | impl<'a> AstNode<'a> for PlaceholderType<'a> { |
2172 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2739 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2173 | match syntax.kind() { | 2740 | match syntax.kind() { |
@@ -2191,12 +2758,20 @@ impl<R: TreeRoot<RaTypes>> PlaceholderTypeNode<R> { | |||
2191 | impl<'a> PlaceholderType<'a> {} | 2758 | impl<'a> PlaceholderType<'a> {} |
2192 | 2759 | ||
2193 | // PointerType | 2760 | // PointerType |
2194 | #[derive(Debug, Clone, Copy)] | 2761 | #[derive(Debug, Clone, Copy,)] |
2195 | pub struct PointerTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2762 | pub struct PointerTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2196 | syntax: SyntaxNode<R>, | 2763 | pub(crate) syntax: SyntaxNode<R>, |
2197 | } | 2764 | } |
2198 | pub type PointerType<'a> = PointerTypeNode<RefRoot<'a>>; | 2765 | pub type PointerType<'a> = PointerTypeNode<RefRoot<'a>>; |
2199 | 2766 | ||
2767 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PointerTypeNode<R1>> for PointerTypeNode<R2> { | ||
2768 | fn eq(&self, other: &PointerTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
2769 | } | ||
2770 | impl<R: TreeRoot<RaTypes>> Eq for PointerTypeNode<R> {} | ||
2771 | impl<R: TreeRoot<RaTypes>> Hash for PointerTypeNode<R> { | ||
2772 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2773 | } | ||
2774 | |||
2200 | impl<'a> AstNode<'a> for PointerType<'a> { | 2775 | impl<'a> AstNode<'a> for PointerType<'a> { |
2201 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2776 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2202 | match syntax.kind() { | 2777 | match syntax.kind() { |
@@ -2220,12 +2795,20 @@ impl<R: TreeRoot<RaTypes>> PointerTypeNode<R> { | |||
2220 | impl<'a> PointerType<'a> {} | 2795 | impl<'a> PointerType<'a> {} |
2221 | 2796 | ||
2222 | // PrefixExpr | 2797 | // PrefixExpr |
2223 | #[derive(Debug, Clone, Copy)] | 2798 | #[derive(Debug, Clone, Copy,)] |
2224 | pub struct PrefixExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2799 | pub struct PrefixExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2225 | syntax: SyntaxNode<R>, | 2800 | pub(crate) syntax: SyntaxNode<R>, |
2226 | } | 2801 | } |
2227 | pub type PrefixExpr<'a> = PrefixExprNode<RefRoot<'a>>; | 2802 | pub type PrefixExpr<'a> = PrefixExprNode<RefRoot<'a>>; |
2228 | 2803 | ||
2804 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PrefixExprNode<R1>> for PrefixExprNode<R2> { | ||
2805 | fn eq(&self, other: &PrefixExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
2806 | } | ||
2807 | impl<R: TreeRoot<RaTypes>> Eq for PrefixExprNode<R> {} | ||
2808 | impl<R: TreeRoot<RaTypes>> Hash for PrefixExprNode<R> { | ||
2809 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2810 | } | ||
2811 | |||
2229 | impl<'a> AstNode<'a> for PrefixExpr<'a> { | 2812 | impl<'a> AstNode<'a> for PrefixExpr<'a> { |
2230 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2813 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2231 | match syntax.kind() { | 2814 | match syntax.kind() { |
@@ -2249,12 +2832,20 @@ impl<R: TreeRoot<RaTypes>> PrefixExprNode<R> { | |||
2249 | impl<'a> PrefixExpr<'a> {} | 2832 | impl<'a> PrefixExpr<'a> {} |
2250 | 2833 | ||
2251 | // RangeExpr | 2834 | // RangeExpr |
2252 | #[derive(Debug, Clone, Copy)] | 2835 | #[derive(Debug, Clone, Copy,)] |
2253 | pub struct RangeExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2836 | pub struct RangeExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2254 | syntax: SyntaxNode<R>, | 2837 | pub(crate) syntax: SyntaxNode<R>, |
2255 | } | 2838 | } |
2256 | pub type RangeExpr<'a> = RangeExprNode<RefRoot<'a>>; | 2839 | pub type RangeExpr<'a> = RangeExprNode<RefRoot<'a>>; |
2257 | 2840 | ||
2841 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RangeExprNode<R1>> for RangeExprNode<R2> { | ||
2842 | fn eq(&self, other: &RangeExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
2843 | } | ||
2844 | impl<R: TreeRoot<RaTypes>> Eq for RangeExprNode<R> {} | ||
2845 | impl<R: TreeRoot<RaTypes>> Hash for RangeExprNode<R> { | ||
2846 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2847 | } | ||
2848 | |||
2258 | impl<'a> AstNode<'a> for RangeExpr<'a> { | 2849 | impl<'a> AstNode<'a> for RangeExpr<'a> { |
2259 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2850 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2260 | match syntax.kind() { | 2851 | match syntax.kind() { |
@@ -2278,12 +2869,20 @@ impl<R: TreeRoot<RaTypes>> RangeExprNode<R> { | |||
2278 | impl<'a> RangeExpr<'a> {} | 2869 | impl<'a> RangeExpr<'a> {} |
2279 | 2870 | ||
2280 | // RangePat | 2871 | // RangePat |
2281 | #[derive(Debug, Clone, Copy)] | 2872 | #[derive(Debug, Clone, Copy,)] |
2282 | pub struct RangePatNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2873 | pub struct RangePatNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2283 | syntax: SyntaxNode<R>, | 2874 | pub(crate) syntax: SyntaxNode<R>, |
2284 | } | 2875 | } |
2285 | pub type RangePat<'a> = RangePatNode<RefRoot<'a>>; | 2876 | pub type RangePat<'a> = RangePatNode<RefRoot<'a>>; |
2286 | 2877 | ||
2878 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RangePatNode<R1>> for RangePatNode<R2> { | ||
2879 | fn eq(&self, other: &RangePatNode<R1>) -> bool { self.syntax == other.syntax } | ||
2880 | } | ||
2881 | impl<R: TreeRoot<RaTypes>> Eq for RangePatNode<R> {} | ||
2882 | impl<R: TreeRoot<RaTypes>> Hash for RangePatNode<R> { | ||
2883 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2884 | } | ||
2885 | |||
2287 | impl<'a> AstNode<'a> for RangePat<'a> { | 2886 | impl<'a> AstNode<'a> for RangePat<'a> { |
2288 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2887 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2289 | match syntax.kind() { | 2888 | match syntax.kind() { |
@@ -2307,12 +2906,20 @@ impl<R: TreeRoot<RaTypes>> RangePatNode<R> { | |||
2307 | impl<'a> RangePat<'a> {} | 2906 | impl<'a> RangePat<'a> {} |
2308 | 2907 | ||
2309 | // RefExpr | 2908 | // RefExpr |
2310 | #[derive(Debug, Clone, Copy)] | 2909 | #[derive(Debug, Clone, Copy,)] |
2311 | pub struct RefExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2910 | pub struct RefExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2312 | syntax: SyntaxNode<R>, | 2911 | pub(crate) syntax: SyntaxNode<R>, |
2313 | } | 2912 | } |
2314 | pub type RefExpr<'a> = RefExprNode<RefRoot<'a>>; | 2913 | pub type RefExpr<'a> = RefExprNode<RefRoot<'a>>; |
2315 | 2914 | ||
2915 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RefExprNode<R1>> for RefExprNode<R2> { | ||
2916 | fn eq(&self, other: &RefExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
2917 | } | ||
2918 | impl<R: TreeRoot<RaTypes>> Eq for RefExprNode<R> {} | ||
2919 | impl<R: TreeRoot<RaTypes>> Hash for RefExprNode<R> { | ||
2920 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2921 | } | ||
2922 | |||
2316 | impl<'a> AstNode<'a> for RefExpr<'a> { | 2923 | impl<'a> AstNode<'a> for RefExpr<'a> { |
2317 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2924 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2318 | match syntax.kind() { | 2925 | match syntax.kind() { |
@@ -2336,12 +2943,20 @@ impl<R: TreeRoot<RaTypes>> RefExprNode<R> { | |||
2336 | impl<'a> RefExpr<'a> {} | 2943 | impl<'a> RefExpr<'a> {} |
2337 | 2944 | ||
2338 | // RefPat | 2945 | // RefPat |
2339 | #[derive(Debug, Clone, Copy)] | 2946 | #[derive(Debug, Clone, Copy,)] |
2340 | pub struct RefPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2947 | pub struct RefPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2341 | syntax: SyntaxNode<R>, | 2948 | pub(crate) syntax: SyntaxNode<R>, |
2342 | } | 2949 | } |
2343 | pub type RefPat<'a> = RefPatNode<RefRoot<'a>>; | 2950 | pub type RefPat<'a> = RefPatNode<RefRoot<'a>>; |
2344 | 2951 | ||
2952 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RefPatNode<R1>> for RefPatNode<R2> { | ||
2953 | fn eq(&self, other: &RefPatNode<R1>) -> bool { self.syntax == other.syntax } | ||
2954 | } | ||
2955 | impl<R: TreeRoot<RaTypes>> Eq for RefPatNode<R> {} | ||
2956 | impl<R: TreeRoot<RaTypes>> Hash for RefPatNode<R> { | ||
2957 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2958 | } | ||
2959 | |||
2345 | impl<'a> AstNode<'a> for RefPat<'a> { | 2960 | impl<'a> AstNode<'a> for RefPat<'a> { |
2346 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2961 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2347 | match syntax.kind() { | 2962 | match syntax.kind() { |
@@ -2365,12 +2980,20 @@ impl<R: TreeRoot<RaTypes>> RefPatNode<R> { | |||
2365 | impl<'a> RefPat<'a> {} | 2980 | impl<'a> RefPat<'a> {} |
2366 | 2981 | ||
2367 | // ReferenceType | 2982 | // ReferenceType |
2368 | #[derive(Debug, Clone, Copy)] | 2983 | #[derive(Debug, Clone, Copy,)] |
2369 | pub struct ReferenceTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 2984 | pub struct ReferenceTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2370 | syntax: SyntaxNode<R>, | 2985 | pub(crate) syntax: SyntaxNode<R>, |
2371 | } | 2986 | } |
2372 | pub type ReferenceType<'a> = ReferenceTypeNode<RefRoot<'a>>; | 2987 | pub type ReferenceType<'a> = ReferenceTypeNode<RefRoot<'a>>; |
2373 | 2988 | ||
2989 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ReferenceTypeNode<R1>> for ReferenceTypeNode<R2> { | ||
2990 | fn eq(&self, other: &ReferenceTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
2991 | } | ||
2992 | impl<R: TreeRoot<RaTypes>> Eq for ReferenceTypeNode<R> {} | ||
2993 | impl<R: TreeRoot<RaTypes>> Hash for ReferenceTypeNode<R> { | ||
2994 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2995 | } | ||
2996 | |||
2374 | impl<'a> AstNode<'a> for ReferenceType<'a> { | 2997 | impl<'a> AstNode<'a> for ReferenceType<'a> { |
2375 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 2998 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2376 | match syntax.kind() { | 2999 | match syntax.kind() { |
@@ -2394,12 +3017,20 @@ impl<R: TreeRoot<RaTypes>> ReferenceTypeNode<R> { | |||
2394 | impl<'a> ReferenceType<'a> {} | 3017 | impl<'a> ReferenceType<'a> {} |
2395 | 3018 | ||
2396 | // RetType | 3019 | // RetType |
2397 | #[derive(Debug, Clone, Copy)] | 3020 | #[derive(Debug, Clone, Copy,)] |
2398 | pub struct RetTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3021 | pub struct RetTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2399 | syntax: SyntaxNode<R>, | 3022 | pub(crate) syntax: SyntaxNode<R>, |
2400 | } | 3023 | } |
2401 | pub type RetType<'a> = RetTypeNode<RefRoot<'a>>; | 3024 | pub type RetType<'a> = RetTypeNode<RefRoot<'a>>; |
2402 | 3025 | ||
3026 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RetTypeNode<R1>> for RetTypeNode<R2> { | ||
3027 | fn eq(&self, other: &RetTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
3028 | } | ||
3029 | impl<R: TreeRoot<RaTypes>> Eq for RetTypeNode<R> {} | ||
3030 | impl<R: TreeRoot<RaTypes>> Hash for RetTypeNode<R> { | ||
3031 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3032 | } | ||
3033 | |||
2403 | impl<'a> AstNode<'a> for RetType<'a> { | 3034 | impl<'a> AstNode<'a> for RetType<'a> { |
2404 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3035 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2405 | match syntax.kind() { | 3036 | match syntax.kind() { |
@@ -2423,12 +3054,20 @@ impl<R: TreeRoot<RaTypes>> RetTypeNode<R> { | |||
2423 | impl<'a> RetType<'a> {} | 3054 | impl<'a> RetType<'a> {} |
2424 | 3055 | ||
2425 | // ReturnExpr | 3056 | // ReturnExpr |
2426 | #[derive(Debug, Clone, Copy)] | 3057 | #[derive(Debug, Clone, Copy,)] |
2427 | pub struct ReturnExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3058 | pub struct ReturnExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2428 | syntax: SyntaxNode<R>, | 3059 | pub(crate) syntax: SyntaxNode<R>, |
2429 | } | 3060 | } |
2430 | pub type ReturnExpr<'a> = ReturnExprNode<RefRoot<'a>>; | 3061 | pub type ReturnExpr<'a> = ReturnExprNode<RefRoot<'a>>; |
2431 | 3062 | ||
3063 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ReturnExprNode<R1>> for ReturnExprNode<R2> { | ||
3064 | fn eq(&self, other: &ReturnExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
3065 | } | ||
3066 | impl<R: TreeRoot<RaTypes>> Eq for ReturnExprNode<R> {} | ||
3067 | impl<R: TreeRoot<RaTypes>> Hash for ReturnExprNode<R> { | ||
3068 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3069 | } | ||
3070 | |||
2432 | impl<'a> AstNode<'a> for ReturnExpr<'a> { | 3071 | impl<'a> AstNode<'a> for ReturnExpr<'a> { |
2433 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3072 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2434 | match syntax.kind() { | 3073 | match syntax.kind() { |
@@ -2451,48 +3090,21 @@ impl<R: TreeRoot<RaTypes>> ReturnExprNode<R> { | |||
2451 | 3090 | ||
2452 | impl<'a> ReturnExpr<'a> {} | 3091 | impl<'a> ReturnExpr<'a> {} |
2453 | 3092 | ||
2454 | // Root | ||
2455 | #[derive(Debug, Clone, Copy)] | ||
2456 | pub struct RootNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
2457 | syntax: SyntaxNode<R>, | ||
2458 | } | ||
2459 | pub type Root<'a> = RootNode<RefRoot<'a>>; | ||
2460 | |||
2461 | impl<'a> AstNode<'a> for Root<'a> { | ||
2462 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
2463 | match syntax.kind() { | ||
2464 | ROOT => Some(Root { syntax }), | ||
2465 | _ => None, | ||
2466 | } | ||
2467 | } | ||
2468 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
2469 | } | ||
2470 | |||
2471 | impl<R: TreeRoot<RaTypes>> RootNode<R> { | ||
2472 | pub fn borrowed(&self) -> Root { | ||
2473 | RootNode { syntax: self.syntax.borrowed() } | ||
2474 | } | ||
2475 | pub fn owned(&self) -> RootNode { | ||
2476 | RootNode { syntax: self.syntax.owned() } | ||
2477 | } | ||
2478 | } | ||
2479 | |||
2480 | |||
2481 | impl<'a> ast::ModuleItemOwner<'a> for Root<'a> {} | ||
2482 | impl<'a> ast::FnDefOwner<'a> for Root<'a> {} | ||
2483 | impl<'a> Root<'a> { | ||
2484 | pub fn modules(self) -> impl Iterator<Item = Module<'a>> + 'a { | ||
2485 | super::children(self) | ||
2486 | } | ||
2487 | } | ||
2488 | |||
2489 | // SelfParam | 3093 | // SelfParam |
2490 | #[derive(Debug, Clone, Copy)] | 3094 | #[derive(Debug, Clone, Copy,)] |
2491 | pub struct SelfParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3095 | pub struct SelfParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2492 | syntax: SyntaxNode<R>, | 3096 | pub(crate) syntax: SyntaxNode<R>, |
2493 | } | 3097 | } |
2494 | pub type SelfParam<'a> = SelfParamNode<RefRoot<'a>>; | 3098 | pub type SelfParam<'a> = SelfParamNode<RefRoot<'a>>; |
2495 | 3099 | ||
3100 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SelfParamNode<R1>> for SelfParamNode<R2> { | ||
3101 | fn eq(&self, other: &SelfParamNode<R1>) -> bool { self.syntax == other.syntax } | ||
3102 | } | ||
3103 | impl<R: TreeRoot<RaTypes>> Eq for SelfParamNode<R> {} | ||
3104 | impl<R: TreeRoot<RaTypes>> Hash for SelfParamNode<R> { | ||
3105 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3106 | } | ||
3107 | |||
2496 | impl<'a> AstNode<'a> for SelfParam<'a> { | 3108 | impl<'a> AstNode<'a> for SelfParam<'a> { |
2497 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3109 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2498 | match syntax.kind() { | 3110 | match syntax.kind() { |
@@ -2516,12 +3128,20 @@ impl<R: TreeRoot<RaTypes>> SelfParamNode<R> { | |||
2516 | impl<'a> SelfParam<'a> {} | 3128 | impl<'a> SelfParam<'a> {} |
2517 | 3129 | ||
2518 | // SlicePat | 3130 | // SlicePat |
2519 | #[derive(Debug, Clone, Copy)] | 3131 | #[derive(Debug, Clone, Copy,)] |
2520 | pub struct SlicePatNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3132 | pub struct SlicePatNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2521 | syntax: SyntaxNode<R>, | 3133 | pub(crate) syntax: SyntaxNode<R>, |
2522 | } | 3134 | } |
2523 | pub type SlicePat<'a> = SlicePatNode<RefRoot<'a>>; | 3135 | pub type SlicePat<'a> = SlicePatNode<RefRoot<'a>>; |
2524 | 3136 | ||
3137 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SlicePatNode<R1>> for SlicePatNode<R2> { | ||
3138 | fn eq(&self, other: &SlicePatNode<R1>) -> bool { self.syntax == other.syntax } | ||
3139 | } | ||
3140 | impl<R: TreeRoot<RaTypes>> Eq for SlicePatNode<R> {} | ||
3141 | impl<R: TreeRoot<RaTypes>> Hash for SlicePatNode<R> { | ||
3142 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3143 | } | ||
3144 | |||
2525 | impl<'a> AstNode<'a> for SlicePat<'a> { | 3145 | impl<'a> AstNode<'a> for SlicePat<'a> { |
2526 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3146 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2527 | match syntax.kind() { | 3147 | match syntax.kind() { |
@@ -2545,12 +3165,20 @@ impl<R: TreeRoot<RaTypes>> SlicePatNode<R> { | |||
2545 | impl<'a> SlicePat<'a> {} | 3165 | impl<'a> SlicePat<'a> {} |
2546 | 3166 | ||
2547 | // SliceType | 3167 | // SliceType |
2548 | #[derive(Debug, Clone, Copy)] | 3168 | #[derive(Debug, Clone, Copy,)] |
2549 | pub struct SliceTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3169 | pub struct SliceTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2550 | syntax: SyntaxNode<R>, | 3170 | pub(crate) syntax: SyntaxNode<R>, |
2551 | } | 3171 | } |
2552 | pub type SliceType<'a> = SliceTypeNode<RefRoot<'a>>; | 3172 | pub type SliceType<'a> = SliceTypeNode<RefRoot<'a>>; |
2553 | 3173 | ||
3174 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SliceTypeNode<R1>> for SliceTypeNode<R2> { | ||
3175 | fn eq(&self, other: &SliceTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
3176 | } | ||
3177 | impl<R: TreeRoot<RaTypes>> Eq for SliceTypeNode<R> {} | ||
3178 | impl<R: TreeRoot<RaTypes>> Hash for SliceTypeNode<R> { | ||
3179 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3180 | } | ||
3181 | |||
2554 | impl<'a> AstNode<'a> for SliceType<'a> { | 3182 | impl<'a> AstNode<'a> for SliceType<'a> { |
2555 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3183 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2556 | match syntax.kind() { | 3184 | match syntax.kind() { |
@@ -2573,13 +3201,64 @@ impl<R: TreeRoot<RaTypes>> SliceTypeNode<R> { | |||
2573 | 3201 | ||
2574 | impl<'a> SliceType<'a> {} | 3202 | impl<'a> SliceType<'a> {} |
2575 | 3203 | ||
3204 | // SourceFile | ||
3205 | #[derive(Debug, Clone, Copy,)] | ||
3206 | pub struct SourceFileNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
3207 | pub(crate) syntax: SyntaxNode<R>, | ||
3208 | } | ||
3209 | pub type SourceFile<'a> = SourceFileNode<RefRoot<'a>>; | ||
3210 | |||
3211 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SourceFileNode<R1>> for SourceFileNode<R2> { | ||
3212 | fn eq(&self, other: &SourceFileNode<R1>) -> bool { self.syntax == other.syntax } | ||
3213 | } | ||
3214 | impl<R: TreeRoot<RaTypes>> Eq for SourceFileNode<R> {} | ||
3215 | impl<R: TreeRoot<RaTypes>> Hash for SourceFileNode<R> { | ||
3216 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3217 | } | ||
3218 | |||
3219 | impl<'a> AstNode<'a> for SourceFile<'a> { | ||
3220 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
3221 | match syntax.kind() { | ||
3222 | SOURCE_FILE => Some(SourceFile { syntax }), | ||
3223 | _ => None, | ||
3224 | } | ||
3225 | } | ||
3226 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
3227 | } | ||
3228 | |||
3229 | impl<R: TreeRoot<RaTypes>> SourceFileNode<R> { | ||
3230 | pub fn borrowed(&self) -> SourceFile { | ||
3231 | SourceFileNode { syntax: self.syntax.borrowed() } | ||
3232 | } | ||
3233 | pub fn owned(&self) -> SourceFileNode { | ||
3234 | SourceFileNode { syntax: self.syntax.owned() } | ||
3235 | } | ||
3236 | } | ||
3237 | |||
3238 | |||
3239 | impl<'a> ast::ModuleItemOwner<'a> for SourceFile<'a> {} | ||
3240 | impl<'a> ast::FnDefOwner<'a> for SourceFile<'a> {} | ||
3241 | impl<'a> SourceFile<'a> { | ||
3242 | pub fn modules(self) -> impl Iterator<Item = Module<'a>> + 'a { | ||
3243 | super::children(self) | ||
3244 | } | ||
3245 | } | ||
3246 | |||
2576 | // StaticDef | 3247 | // StaticDef |
2577 | #[derive(Debug, Clone, Copy)] | 3248 | #[derive(Debug, Clone, Copy,)] |
2578 | pub struct StaticDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3249 | pub struct StaticDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2579 | syntax: SyntaxNode<R>, | 3250 | pub(crate) syntax: SyntaxNode<R>, |
2580 | } | 3251 | } |
2581 | pub type StaticDef<'a> = StaticDefNode<RefRoot<'a>>; | 3252 | pub type StaticDef<'a> = StaticDefNode<RefRoot<'a>>; |
2582 | 3253 | ||
3254 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StaticDefNode<R1>> for StaticDefNode<R2> { | ||
3255 | fn eq(&self, other: &StaticDefNode<R1>) -> bool { self.syntax == other.syntax } | ||
3256 | } | ||
3257 | impl<R: TreeRoot<RaTypes>> Eq for StaticDefNode<R> {} | ||
3258 | impl<R: TreeRoot<RaTypes>> Hash for StaticDefNode<R> { | ||
3259 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3260 | } | ||
3261 | |||
2583 | impl<'a> AstNode<'a> for StaticDef<'a> { | 3262 | impl<'a> AstNode<'a> for StaticDef<'a> { |
2584 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3263 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2585 | match syntax.kind() { | 3264 | match syntax.kind() { |
@@ -2603,10 +3282,11 @@ impl<R: TreeRoot<RaTypes>> StaticDefNode<R> { | |||
2603 | impl<'a> ast::NameOwner<'a> for StaticDef<'a> {} | 3282 | impl<'a> ast::NameOwner<'a> for StaticDef<'a> {} |
2604 | impl<'a> ast::TypeParamsOwner<'a> for StaticDef<'a> {} | 3283 | impl<'a> ast::TypeParamsOwner<'a> for StaticDef<'a> {} |
2605 | impl<'a> ast::AttrsOwner<'a> for StaticDef<'a> {} | 3284 | impl<'a> ast::AttrsOwner<'a> for StaticDef<'a> {} |
3285 | impl<'a> ast::DocCommentsOwner<'a> for StaticDef<'a> {} | ||
2606 | impl<'a> StaticDef<'a> {} | 3286 | impl<'a> StaticDef<'a> {} |
2607 | 3287 | ||
2608 | // Stmt | 3288 | // Stmt |
2609 | #[derive(Debug, Clone, Copy)] | 3289 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
2610 | pub enum Stmt<'a> { | 3290 | pub enum Stmt<'a> { |
2611 | ExprStmt(ExprStmt<'a>), | 3291 | ExprStmt(ExprStmt<'a>), |
2612 | LetStmt(LetStmt<'a>), | 3292 | LetStmt(LetStmt<'a>), |
@@ -2630,13 +3310,58 @@ impl<'a> AstNode<'a> for Stmt<'a> { | |||
2630 | 3310 | ||
2631 | impl<'a> Stmt<'a> {} | 3311 | impl<'a> Stmt<'a> {} |
2632 | 3312 | ||
3313 | // String | ||
3314 | #[derive(Debug, Clone, Copy,)] | ||
3315 | pub struct StringNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
3316 | pub(crate) syntax: SyntaxNode<R>, | ||
3317 | } | ||
3318 | pub type String<'a> = StringNode<RefRoot<'a>>; | ||
3319 | |||
3320 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StringNode<R1>> for StringNode<R2> { | ||
3321 | fn eq(&self, other: &StringNode<R1>) -> bool { self.syntax == other.syntax } | ||
3322 | } | ||
3323 | impl<R: TreeRoot<RaTypes>> Eq for StringNode<R> {} | ||
3324 | impl<R: TreeRoot<RaTypes>> Hash for StringNode<R> { | ||
3325 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3326 | } | ||
3327 | |||
3328 | impl<'a> AstNode<'a> for String<'a> { | ||
3329 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
3330 | match syntax.kind() { | ||
3331 | STRING => Some(String { syntax }), | ||
3332 | _ => None, | ||
3333 | } | ||
3334 | } | ||
3335 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
3336 | } | ||
3337 | |||
3338 | impl<R: TreeRoot<RaTypes>> StringNode<R> { | ||
3339 | pub fn borrowed(&self) -> String { | ||
3340 | StringNode { syntax: self.syntax.borrowed() } | ||
3341 | } | ||
3342 | pub fn owned(&self) -> StringNode { | ||
3343 | StringNode { syntax: self.syntax.owned() } | ||
3344 | } | ||
3345 | } | ||
3346 | |||
3347 | |||
3348 | impl<'a> String<'a> {} | ||
3349 | |||
2633 | // StructDef | 3350 | // StructDef |
2634 | #[derive(Debug, Clone, Copy)] | 3351 | #[derive(Debug, Clone, Copy,)] |
2635 | pub struct StructDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3352 | pub struct StructDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2636 | syntax: SyntaxNode<R>, | 3353 | pub(crate) syntax: SyntaxNode<R>, |
2637 | } | 3354 | } |
2638 | pub type StructDef<'a> = StructDefNode<RefRoot<'a>>; | 3355 | pub type StructDef<'a> = StructDefNode<RefRoot<'a>>; |
2639 | 3356 | ||
3357 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StructDefNode<R1>> for StructDefNode<R2> { | ||
3358 | fn eq(&self, other: &StructDefNode<R1>) -> bool { self.syntax == other.syntax } | ||
3359 | } | ||
3360 | impl<R: TreeRoot<RaTypes>> Eq for StructDefNode<R> {} | ||
3361 | impl<R: TreeRoot<RaTypes>> Hash for StructDefNode<R> { | ||
3362 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3363 | } | ||
3364 | |||
2640 | impl<'a> AstNode<'a> for StructDef<'a> { | 3365 | impl<'a> AstNode<'a> for StructDef<'a> { |
2641 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3366 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2642 | match syntax.kind() { | 3367 | match syntax.kind() { |
@@ -2660,6 +3385,7 @@ impl<R: TreeRoot<RaTypes>> StructDefNode<R> { | |||
2660 | impl<'a> ast::NameOwner<'a> for StructDef<'a> {} | 3385 | impl<'a> ast::NameOwner<'a> for StructDef<'a> {} |
2661 | impl<'a> ast::TypeParamsOwner<'a> for StructDef<'a> {} | 3386 | impl<'a> ast::TypeParamsOwner<'a> for StructDef<'a> {} |
2662 | impl<'a> ast::AttrsOwner<'a> for StructDef<'a> {} | 3387 | impl<'a> ast::AttrsOwner<'a> for StructDef<'a> {} |
3388 | impl<'a> ast::DocCommentsOwner<'a> for StructDef<'a> {} | ||
2663 | impl<'a> StructDef<'a> { | 3389 | impl<'a> StructDef<'a> { |
2664 | pub fn fields(self) -> impl Iterator<Item = NamedFieldDef<'a>> + 'a { | 3390 | pub fn fields(self) -> impl Iterator<Item = NamedFieldDef<'a>> + 'a { |
2665 | super::children(self) | 3391 | super::children(self) |
@@ -2667,12 +3393,20 @@ impl<'a> StructDef<'a> { | |||
2667 | } | 3393 | } |
2668 | 3394 | ||
2669 | // StructLit | 3395 | // StructLit |
2670 | #[derive(Debug, Clone, Copy)] | 3396 | #[derive(Debug, Clone, Copy,)] |
2671 | pub struct StructLitNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3397 | pub struct StructLitNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2672 | syntax: SyntaxNode<R>, | 3398 | pub(crate) syntax: SyntaxNode<R>, |
2673 | } | 3399 | } |
2674 | pub type StructLit<'a> = StructLitNode<RefRoot<'a>>; | 3400 | pub type StructLit<'a> = StructLitNode<RefRoot<'a>>; |
2675 | 3401 | ||
3402 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StructLitNode<R1>> for StructLitNode<R2> { | ||
3403 | fn eq(&self, other: &StructLitNode<R1>) -> bool { self.syntax == other.syntax } | ||
3404 | } | ||
3405 | impl<R: TreeRoot<RaTypes>> Eq for StructLitNode<R> {} | ||
3406 | impl<R: TreeRoot<RaTypes>> Hash for StructLitNode<R> { | ||
3407 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3408 | } | ||
3409 | |||
2676 | impl<'a> AstNode<'a> for StructLit<'a> { | 3410 | impl<'a> AstNode<'a> for StructLit<'a> { |
2677 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3411 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2678 | match syntax.kind() { | 3412 | match syntax.kind() { |
@@ -2696,12 +3430,20 @@ impl<R: TreeRoot<RaTypes>> StructLitNode<R> { | |||
2696 | impl<'a> StructLit<'a> {} | 3430 | impl<'a> StructLit<'a> {} |
2697 | 3431 | ||
2698 | // StructPat | 3432 | // StructPat |
2699 | #[derive(Debug, Clone, Copy)] | 3433 | #[derive(Debug, Clone, Copy,)] |
2700 | pub struct StructPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3434 | pub struct StructPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2701 | syntax: SyntaxNode<R>, | 3435 | pub(crate) syntax: SyntaxNode<R>, |
2702 | } | 3436 | } |
2703 | pub type StructPat<'a> = StructPatNode<RefRoot<'a>>; | 3437 | pub type StructPat<'a> = StructPatNode<RefRoot<'a>>; |
2704 | 3438 | ||
3439 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StructPatNode<R1>> for StructPatNode<R2> { | ||
3440 | fn eq(&self, other: &StructPatNode<R1>) -> bool { self.syntax == other.syntax } | ||
3441 | } | ||
3442 | impl<R: TreeRoot<RaTypes>> Eq for StructPatNode<R> {} | ||
3443 | impl<R: TreeRoot<RaTypes>> Hash for StructPatNode<R> { | ||
3444 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3445 | } | ||
3446 | |||
2705 | impl<'a> AstNode<'a> for StructPat<'a> { | 3447 | impl<'a> AstNode<'a> for StructPat<'a> { |
2706 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3448 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2707 | match syntax.kind() { | 3449 | match syntax.kind() { |
@@ -2725,12 +3467,20 @@ impl<R: TreeRoot<RaTypes>> StructPatNode<R> { | |||
2725 | impl<'a> StructPat<'a> {} | 3467 | impl<'a> StructPat<'a> {} |
2726 | 3468 | ||
2727 | // TokenTree | 3469 | // TokenTree |
2728 | #[derive(Debug, Clone, Copy)] | 3470 | #[derive(Debug, Clone, Copy,)] |
2729 | pub struct TokenTreeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3471 | pub struct TokenTreeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2730 | syntax: SyntaxNode<R>, | 3472 | pub(crate) syntax: SyntaxNode<R>, |
2731 | } | 3473 | } |
2732 | pub type TokenTree<'a> = TokenTreeNode<RefRoot<'a>>; | 3474 | pub type TokenTree<'a> = TokenTreeNode<RefRoot<'a>>; |
2733 | 3475 | ||
3476 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TokenTreeNode<R1>> for TokenTreeNode<R2> { | ||
3477 | fn eq(&self, other: &TokenTreeNode<R1>) -> bool { self.syntax == other.syntax } | ||
3478 | } | ||
3479 | impl<R: TreeRoot<RaTypes>> Eq for TokenTreeNode<R> {} | ||
3480 | impl<R: TreeRoot<RaTypes>> Hash for TokenTreeNode<R> { | ||
3481 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3482 | } | ||
3483 | |||
2734 | impl<'a> AstNode<'a> for TokenTree<'a> { | 3484 | impl<'a> AstNode<'a> for TokenTree<'a> { |
2735 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3485 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2736 | match syntax.kind() { | 3486 | match syntax.kind() { |
@@ -2754,12 +3504,20 @@ impl<R: TreeRoot<RaTypes>> TokenTreeNode<R> { | |||
2754 | impl<'a> TokenTree<'a> {} | 3504 | impl<'a> TokenTree<'a> {} |
2755 | 3505 | ||
2756 | // TraitDef | 3506 | // TraitDef |
2757 | #[derive(Debug, Clone, Copy)] | 3507 | #[derive(Debug, Clone, Copy,)] |
2758 | pub struct TraitDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3508 | pub struct TraitDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2759 | syntax: SyntaxNode<R>, | 3509 | pub(crate) syntax: SyntaxNode<R>, |
2760 | } | 3510 | } |
2761 | pub type TraitDef<'a> = TraitDefNode<RefRoot<'a>>; | 3511 | pub type TraitDef<'a> = TraitDefNode<RefRoot<'a>>; |
2762 | 3512 | ||
3513 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TraitDefNode<R1>> for TraitDefNode<R2> { | ||
3514 | fn eq(&self, other: &TraitDefNode<R1>) -> bool { self.syntax == other.syntax } | ||
3515 | } | ||
3516 | impl<R: TreeRoot<RaTypes>> Eq for TraitDefNode<R> {} | ||
3517 | impl<R: TreeRoot<RaTypes>> Hash for TraitDefNode<R> { | ||
3518 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3519 | } | ||
3520 | |||
2763 | impl<'a> AstNode<'a> for TraitDef<'a> { | 3521 | impl<'a> AstNode<'a> for TraitDef<'a> { |
2764 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3522 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2765 | match syntax.kind() { | 3523 | match syntax.kind() { |
@@ -2782,15 +3540,24 @@ impl<R: TreeRoot<RaTypes>> TraitDefNode<R> { | |||
2782 | 3540 | ||
2783 | impl<'a> ast::NameOwner<'a> for TraitDef<'a> {} | 3541 | impl<'a> ast::NameOwner<'a> for TraitDef<'a> {} |
2784 | impl<'a> ast::AttrsOwner<'a> for TraitDef<'a> {} | 3542 | impl<'a> ast::AttrsOwner<'a> for TraitDef<'a> {} |
3543 | impl<'a> ast::DocCommentsOwner<'a> for TraitDef<'a> {} | ||
2785 | impl<'a> TraitDef<'a> {} | 3544 | impl<'a> TraitDef<'a> {} |
2786 | 3545 | ||
2787 | // TryExpr | 3546 | // TryExpr |
2788 | #[derive(Debug, Clone, Copy)] | 3547 | #[derive(Debug, Clone, Copy,)] |
2789 | pub struct TryExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3548 | pub struct TryExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2790 | syntax: SyntaxNode<R>, | 3549 | pub(crate) syntax: SyntaxNode<R>, |
2791 | } | 3550 | } |
2792 | pub type TryExpr<'a> = TryExprNode<RefRoot<'a>>; | 3551 | pub type TryExpr<'a> = TryExprNode<RefRoot<'a>>; |
2793 | 3552 | ||
3553 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TryExprNode<R1>> for TryExprNode<R2> { | ||
3554 | fn eq(&self, other: &TryExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
3555 | } | ||
3556 | impl<R: TreeRoot<RaTypes>> Eq for TryExprNode<R> {} | ||
3557 | impl<R: TreeRoot<RaTypes>> Hash for TryExprNode<R> { | ||
3558 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3559 | } | ||
3560 | |||
2794 | impl<'a> AstNode<'a> for TryExpr<'a> { | 3561 | impl<'a> AstNode<'a> for TryExpr<'a> { |
2795 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3562 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2796 | match syntax.kind() { | 3563 | match syntax.kind() { |
@@ -2814,12 +3581,20 @@ impl<R: TreeRoot<RaTypes>> TryExprNode<R> { | |||
2814 | impl<'a> TryExpr<'a> {} | 3581 | impl<'a> TryExpr<'a> {} |
2815 | 3582 | ||
2816 | // TupleExpr | 3583 | // TupleExpr |
2817 | #[derive(Debug, Clone, Copy)] | 3584 | #[derive(Debug, Clone, Copy,)] |
2818 | pub struct TupleExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3585 | pub struct TupleExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2819 | syntax: SyntaxNode<R>, | 3586 | pub(crate) syntax: SyntaxNode<R>, |
2820 | } | 3587 | } |
2821 | pub type TupleExpr<'a> = TupleExprNode<RefRoot<'a>>; | 3588 | pub type TupleExpr<'a> = TupleExprNode<RefRoot<'a>>; |
2822 | 3589 | ||
3590 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TupleExprNode<R1>> for TupleExprNode<R2> { | ||
3591 | fn eq(&self, other: &TupleExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
3592 | } | ||
3593 | impl<R: TreeRoot<RaTypes>> Eq for TupleExprNode<R> {} | ||
3594 | impl<R: TreeRoot<RaTypes>> Hash for TupleExprNode<R> { | ||
3595 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3596 | } | ||
3597 | |||
2823 | impl<'a> AstNode<'a> for TupleExpr<'a> { | 3598 | impl<'a> AstNode<'a> for TupleExpr<'a> { |
2824 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3599 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2825 | match syntax.kind() { | 3600 | match syntax.kind() { |
@@ -2843,12 +3618,20 @@ impl<R: TreeRoot<RaTypes>> TupleExprNode<R> { | |||
2843 | impl<'a> TupleExpr<'a> {} | 3618 | impl<'a> TupleExpr<'a> {} |
2844 | 3619 | ||
2845 | // TuplePat | 3620 | // TuplePat |
2846 | #[derive(Debug, Clone, Copy)] | 3621 | #[derive(Debug, Clone, Copy,)] |
2847 | pub struct TuplePatNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3622 | pub struct TuplePatNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2848 | syntax: SyntaxNode<R>, | 3623 | pub(crate) syntax: SyntaxNode<R>, |
2849 | } | 3624 | } |
2850 | pub type TuplePat<'a> = TuplePatNode<RefRoot<'a>>; | 3625 | pub type TuplePat<'a> = TuplePatNode<RefRoot<'a>>; |
2851 | 3626 | ||
3627 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TuplePatNode<R1>> for TuplePatNode<R2> { | ||
3628 | fn eq(&self, other: &TuplePatNode<R1>) -> bool { self.syntax == other.syntax } | ||
3629 | } | ||
3630 | impl<R: TreeRoot<RaTypes>> Eq for TuplePatNode<R> {} | ||
3631 | impl<R: TreeRoot<RaTypes>> Hash for TuplePatNode<R> { | ||
3632 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3633 | } | ||
3634 | |||
2852 | impl<'a> AstNode<'a> for TuplePat<'a> { | 3635 | impl<'a> AstNode<'a> for TuplePat<'a> { |
2853 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3636 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2854 | match syntax.kind() { | 3637 | match syntax.kind() { |
@@ -2872,12 +3655,20 @@ impl<R: TreeRoot<RaTypes>> TuplePatNode<R> { | |||
2872 | impl<'a> TuplePat<'a> {} | 3655 | impl<'a> TuplePat<'a> {} |
2873 | 3656 | ||
2874 | // TupleStructPat | 3657 | // TupleStructPat |
2875 | #[derive(Debug, Clone, Copy)] | 3658 | #[derive(Debug, Clone, Copy,)] |
2876 | pub struct TupleStructPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3659 | pub struct TupleStructPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2877 | syntax: SyntaxNode<R>, | 3660 | pub(crate) syntax: SyntaxNode<R>, |
2878 | } | 3661 | } |
2879 | pub type TupleStructPat<'a> = TupleStructPatNode<RefRoot<'a>>; | 3662 | pub type TupleStructPat<'a> = TupleStructPatNode<RefRoot<'a>>; |
2880 | 3663 | ||
3664 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TupleStructPatNode<R1>> for TupleStructPatNode<R2> { | ||
3665 | fn eq(&self, other: &TupleStructPatNode<R1>) -> bool { self.syntax == other.syntax } | ||
3666 | } | ||
3667 | impl<R: TreeRoot<RaTypes>> Eq for TupleStructPatNode<R> {} | ||
3668 | impl<R: TreeRoot<RaTypes>> Hash for TupleStructPatNode<R> { | ||
3669 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3670 | } | ||
3671 | |||
2881 | impl<'a> AstNode<'a> for TupleStructPat<'a> { | 3672 | impl<'a> AstNode<'a> for TupleStructPat<'a> { |
2882 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3673 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2883 | match syntax.kind() { | 3674 | match syntax.kind() { |
@@ -2901,12 +3692,20 @@ impl<R: TreeRoot<RaTypes>> TupleStructPatNode<R> { | |||
2901 | impl<'a> TupleStructPat<'a> {} | 3692 | impl<'a> TupleStructPat<'a> {} |
2902 | 3693 | ||
2903 | // TupleType | 3694 | // TupleType |
2904 | #[derive(Debug, Clone, Copy)] | 3695 | #[derive(Debug, Clone, Copy,)] |
2905 | pub struct TupleTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3696 | pub struct TupleTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2906 | syntax: SyntaxNode<R>, | 3697 | pub(crate) syntax: SyntaxNode<R>, |
2907 | } | 3698 | } |
2908 | pub type TupleType<'a> = TupleTypeNode<RefRoot<'a>>; | 3699 | pub type TupleType<'a> = TupleTypeNode<RefRoot<'a>>; |
2909 | 3700 | ||
3701 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TupleTypeNode<R1>> for TupleTypeNode<R2> { | ||
3702 | fn eq(&self, other: &TupleTypeNode<R1>) -> bool { self.syntax == other.syntax } | ||
3703 | } | ||
3704 | impl<R: TreeRoot<RaTypes>> Eq for TupleTypeNode<R> {} | ||
3705 | impl<R: TreeRoot<RaTypes>> Hash for TupleTypeNode<R> { | ||
3706 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3707 | } | ||
3708 | |||
2910 | impl<'a> AstNode<'a> for TupleType<'a> { | 3709 | impl<'a> AstNode<'a> for TupleType<'a> { |
2911 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3710 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2912 | match syntax.kind() { | 3711 | match syntax.kind() { |
@@ -2930,12 +3729,20 @@ impl<R: TreeRoot<RaTypes>> TupleTypeNode<R> { | |||
2930 | impl<'a> TupleType<'a> {} | 3729 | impl<'a> TupleType<'a> {} |
2931 | 3730 | ||
2932 | // TypeDef | 3731 | // TypeDef |
2933 | #[derive(Debug, Clone, Copy)] | 3732 | #[derive(Debug, Clone, Copy,)] |
2934 | pub struct TypeDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3733 | pub struct TypeDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2935 | syntax: SyntaxNode<R>, | 3734 | pub(crate) syntax: SyntaxNode<R>, |
2936 | } | 3735 | } |
2937 | pub type TypeDef<'a> = TypeDefNode<RefRoot<'a>>; | 3736 | pub type TypeDef<'a> = TypeDefNode<RefRoot<'a>>; |
2938 | 3737 | ||
3738 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TypeDefNode<R1>> for TypeDefNode<R2> { | ||
3739 | fn eq(&self, other: &TypeDefNode<R1>) -> bool { self.syntax == other.syntax } | ||
3740 | } | ||
3741 | impl<R: TreeRoot<RaTypes>> Eq for TypeDefNode<R> {} | ||
3742 | impl<R: TreeRoot<RaTypes>> Hash for TypeDefNode<R> { | ||
3743 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3744 | } | ||
3745 | |||
2939 | impl<'a> AstNode<'a> for TypeDef<'a> { | 3746 | impl<'a> AstNode<'a> for TypeDef<'a> { |
2940 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3747 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2941 | match syntax.kind() { | 3748 | match syntax.kind() { |
@@ -2959,15 +3766,24 @@ impl<R: TreeRoot<RaTypes>> TypeDefNode<R> { | |||
2959 | impl<'a> ast::NameOwner<'a> for TypeDef<'a> {} | 3766 | impl<'a> ast::NameOwner<'a> for TypeDef<'a> {} |
2960 | impl<'a> ast::TypeParamsOwner<'a> for TypeDef<'a> {} | 3767 | impl<'a> ast::TypeParamsOwner<'a> for TypeDef<'a> {} |
2961 | impl<'a> ast::AttrsOwner<'a> for TypeDef<'a> {} | 3768 | impl<'a> ast::AttrsOwner<'a> for TypeDef<'a> {} |
3769 | impl<'a> ast::DocCommentsOwner<'a> for TypeDef<'a> {} | ||
2962 | impl<'a> TypeDef<'a> {} | 3770 | impl<'a> TypeDef<'a> {} |
2963 | 3771 | ||
2964 | // TypeParam | 3772 | // TypeParam |
2965 | #[derive(Debug, Clone, Copy)] | 3773 | #[derive(Debug, Clone, Copy,)] |
2966 | pub struct TypeParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3774 | pub struct TypeParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2967 | syntax: SyntaxNode<R>, | 3775 | pub(crate) syntax: SyntaxNode<R>, |
2968 | } | 3776 | } |
2969 | pub type TypeParam<'a> = TypeParamNode<RefRoot<'a>>; | 3777 | pub type TypeParam<'a> = TypeParamNode<RefRoot<'a>>; |
2970 | 3778 | ||
3779 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TypeParamNode<R1>> for TypeParamNode<R2> { | ||
3780 | fn eq(&self, other: &TypeParamNode<R1>) -> bool { self.syntax == other.syntax } | ||
3781 | } | ||
3782 | impl<R: TreeRoot<RaTypes>> Eq for TypeParamNode<R> {} | ||
3783 | impl<R: TreeRoot<RaTypes>> Hash for TypeParamNode<R> { | ||
3784 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3785 | } | ||
3786 | |||
2971 | impl<'a> AstNode<'a> for TypeParam<'a> { | 3787 | impl<'a> AstNode<'a> for TypeParam<'a> { |
2972 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3788 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
2973 | match syntax.kind() { | 3789 | match syntax.kind() { |
@@ -2992,12 +3808,20 @@ impl<'a> ast::NameOwner<'a> for TypeParam<'a> {} | |||
2992 | impl<'a> TypeParam<'a> {} | 3808 | impl<'a> TypeParam<'a> {} |
2993 | 3809 | ||
2994 | // TypeParamList | 3810 | // TypeParamList |
2995 | #[derive(Debug, Clone, Copy)] | 3811 | #[derive(Debug, Clone, Copy,)] |
2996 | pub struct TypeParamListNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3812 | pub struct TypeParamListNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
2997 | syntax: SyntaxNode<R>, | 3813 | pub(crate) syntax: SyntaxNode<R>, |
2998 | } | 3814 | } |
2999 | pub type TypeParamList<'a> = TypeParamListNode<RefRoot<'a>>; | 3815 | pub type TypeParamList<'a> = TypeParamListNode<RefRoot<'a>>; |
3000 | 3816 | ||
3817 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TypeParamListNode<R1>> for TypeParamListNode<R2> { | ||
3818 | fn eq(&self, other: &TypeParamListNode<R1>) -> bool { self.syntax == other.syntax } | ||
3819 | } | ||
3820 | impl<R: TreeRoot<RaTypes>> Eq for TypeParamListNode<R> {} | ||
3821 | impl<R: TreeRoot<RaTypes>> Hash for TypeParamListNode<R> { | ||
3822 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3823 | } | ||
3824 | |||
3001 | impl<'a> AstNode<'a> for TypeParamList<'a> { | 3825 | impl<'a> AstNode<'a> for TypeParamList<'a> { |
3002 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3826 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
3003 | match syntax.kind() { | 3827 | match syntax.kind() { |
@@ -3029,7 +3853,7 @@ impl<'a> TypeParamList<'a> { | |||
3029 | } | 3853 | } |
3030 | 3854 | ||
3031 | // TypeRef | 3855 | // TypeRef |
3032 | #[derive(Debug, Clone, Copy)] | 3856 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
3033 | pub enum TypeRef<'a> { | 3857 | pub enum TypeRef<'a> { |
3034 | ParenType(ParenType<'a>), | 3858 | ParenType(ParenType<'a>), |
3035 | TupleType(TupleType<'a>), | 3859 | TupleType(TupleType<'a>), |
@@ -3087,12 +3911,20 @@ impl<'a> AstNode<'a> for TypeRef<'a> { | |||
3087 | impl<'a> TypeRef<'a> {} | 3911 | impl<'a> TypeRef<'a> {} |
3088 | 3912 | ||
3089 | // UseItem | 3913 | // UseItem |
3090 | #[derive(Debug, Clone, Copy)] | 3914 | #[derive(Debug, Clone, Copy,)] |
3091 | pub struct UseItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3915 | pub struct UseItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
3092 | syntax: SyntaxNode<R>, | 3916 | pub(crate) syntax: SyntaxNode<R>, |
3093 | } | 3917 | } |
3094 | pub type UseItem<'a> = UseItemNode<RefRoot<'a>>; | 3918 | pub type UseItem<'a> = UseItemNode<RefRoot<'a>>; |
3095 | 3919 | ||
3920 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<UseItemNode<R1>> for UseItemNode<R2> { | ||
3921 | fn eq(&self, other: &UseItemNode<R1>) -> bool { self.syntax == other.syntax } | ||
3922 | } | ||
3923 | impl<R: TreeRoot<RaTypes>> Eq for UseItemNode<R> {} | ||
3924 | impl<R: TreeRoot<RaTypes>> Hash for UseItemNode<R> { | ||
3925 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3926 | } | ||
3927 | |||
3096 | impl<'a> AstNode<'a> for UseItem<'a> { | 3928 | impl<'a> AstNode<'a> for UseItem<'a> { |
3097 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3929 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
3098 | match syntax.kind() { | 3930 | match syntax.kind() { |
@@ -3120,12 +3952,20 @@ impl<'a> UseItem<'a> { | |||
3120 | } | 3952 | } |
3121 | 3953 | ||
3122 | // UseTree | 3954 | // UseTree |
3123 | #[derive(Debug, Clone, Copy)] | 3955 | #[derive(Debug, Clone, Copy,)] |
3124 | pub struct UseTreeNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3956 | pub struct UseTreeNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
3125 | syntax: SyntaxNode<R>, | 3957 | pub(crate) syntax: SyntaxNode<R>, |
3126 | } | 3958 | } |
3127 | pub type UseTree<'a> = UseTreeNode<RefRoot<'a>>; | 3959 | pub type UseTree<'a> = UseTreeNode<RefRoot<'a>>; |
3128 | 3960 | ||
3961 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<UseTreeNode<R1>> for UseTreeNode<R2> { | ||
3962 | fn eq(&self, other: &UseTreeNode<R1>) -> bool { self.syntax == other.syntax } | ||
3963 | } | ||
3964 | impl<R: TreeRoot<RaTypes>> Eq for UseTreeNode<R> {} | ||
3965 | impl<R: TreeRoot<RaTypes>> Hash for UseTreeNode<R> { | ||
3966 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3967 | } | ||
3968 | |||
3129 | impl<'a> AstNode<'a> for UseTree<'a> { | 3969 | impl<'a> AstNode<'a> for UseTree<'a> { |
3130 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 3970 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
3131 | match syntax.kind() { | 3971 | match syntax.kind() { |
@@ -3157,12 +3997,20 @@ impl<'a> UseTree<'a> { | |||
3157 | } | 3997 | } |
3158 | 3998 | ||
3159 | // UseTreeList | 3999 | // UseTreeList |
3160 | #[derive(Debug, Clone, Copy)] | 4000 | #[derive(Debug, Clone, Copy,)] |
3161 | pub struct UseTreeListNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 4001 | pub struct UseTreeListNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
3162 | syntax: SyntaxNode<R>, | 4002 | pub(crate) syntax: SyntaxNode<R>, |
3163 | } | 4003 | } |
3164 | pub type UseTreeList<'a> = UseTreeListNode<RefRoot<'a>>; | 4004 | pub type UseTreeList<'a> = UseTreeListNode<RefRoot<'a>>; |
3165 | 4005 | ||
4006 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<UseTreeListNode<R1>> for UseTreeListNode<R2> { | ||
4007 | fn eq(&self, other: &UseTreeListNode<R1>) -> bool { self.syntax == other.syntax } | ||
4008 | } | ||
4009 | impl<R: TreeRoot<RaTypes>> Eq for UseTreeListNode<R> {} | ||
4010 | impl<R: TreeRoot<RaTypes>> Hash for UseTreeListNode<R> { | ||
4011 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
4012 | } | ||
4013 | |||
3166 | impl<'a> AstNode<'a> for UseTreeList<'a> { | 4014 | impl<'a> AstNode<'a> for UseTreeList<'a> { |
3167 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 4015 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
3168 | match syntax.kind() { | 4016 | match syntax.kind() { |
@@ -3190,12 +4038,20 @@ impl<'a> UseTreeList<'a> { | |||
3190 | } | 4038 | } |
3191 | 4039 | ||
3192 | // WhereClause | 4040 | // WhereClause |
3193 | #[derive(Debug, Clone, Copy)] | 4041 | #[derive(Debug, Clone, Copy,)] |
3194 | pub struct WhereClauseNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 4042 | pub struct WhereClauseNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
3195 | syntax: SyntaxNode<R>, | 4043 | pub(crate) syntax: SyntaxNode<R>, |
3196 | } | 4044 | } |
3197 | pub type WhereClause<'a> = WhereClauseNode<RefRoot<'a>>; | 4045 | pub type WhereClause<'a> = WhereClauseNode<RefRoot<'a>>; |
3198 | 4046 | ||
4047 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<WhereClauseNode<R1>> for WhereClauseNode<R2> { | ||
4048 | fn eq(&self, other: &WhereClauseNode<R1>) -> bool { self.syntax == other.syntax } | ||
4049 | } | ||
4050 | impl<R: TreeRoot<RaTypes>> Eq for WhereClauseNode<R> {} | ||
4051 | impl<R: TreeRoot<RaTypes>> Hash for WhereClauseNode<R> { | ||
4052 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
4053 | } | ||
4054 | |||
3199 | impl<'a> AstNode<'a> for WhereClause<'a> { | 4055 | impl<'a> AstNode<'a> for WhereClause<'a> { |
3200 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 4056 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
3201 | match syntax.kind() { | 4057 | match syntax.kind() { |
@@ -3219,12 +4075,20 @@ impl<R: TreeRoot<RaTypes>> WhereClauseNode<R> { | |||
3219 | impl<'a> WhereClause<'a> {} | 4075 | impl<'a> WhereClause<'a> {} |
3220 | 4076 | ||
3221 | // WhileExpr | 4077 | // WhileExpr |
3222 | #[derive(Debug, Clone, Copy)] | 4078 | #[derive(Debug, Clone, Copy,)] |
3223 | pub struct WhileExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 4079 | pub struct WhileExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
3224 | syntax: SyntaxNode<R>, | 4080 | pub(crate) syntax: SyntaxNode<R>, |
3225 | } | 4081 | } |
3226 | pub type WhileExpr<'a> = WhileExprNode<RefRoot<'a>>; | 4082 | pub type WhileExpr<'a> = WhileExprNode<RefRoot<'a>>; |
3227 | 4083 | ||
4084 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<WhileExprNode<R1>> for WhileExprNode<R2> { | ||
4085 | fn eq(&self, other: &WhileExprNode<R1>) -> bool { self.syntax == other.syntax } | ||
4086 | } | ||
4087 | impl<R: TreeRoot<RaTypes>> Eq for WhileExprNode<R> {} | ||
4088 | impl<R: TreeRoot<RaTypes>> Hash for WhileExprNode<R> { | ||
4089 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
4090 | } | ||
4091 | |||
3228 | impl<'a> AstNode<'a> for WhileExpr<'a> { | 4092 | impl<'a> AstNode<'a> for WhileExpr<'a> { |
3229 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 4093 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
3230 | match syntax.kind() { | 4094 | match syntax.kind() { |
@@ -3253,12 +4117,20 @@ impl<'a> WhileExpr<'a> { | |||
3253 | } | 4117 | } |
3254 | 4118 | ||
3255 | // Whitespace | 4119 | // Whitespace |
3256 | #[derive(Debug, Clone, Copy)] | 4120 | #[derive(Debug, Clone, Copy,)] |
3257 | pub struct WhitespaceNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 4121 | pub struct WhitespaceNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
3258 | syntax: SyntaxNode<R>, | 4122 | pub(crate) syntax: SyntaxNode<R>, |
3259 | } | 4123 | } |
3260 | pub type Whitespace<'a> = WhitespaceNode<RefRoot<'a>>; | 4124 | pub type Whitespace<'a> = WhitespaceNode<RefRoot<'a>>; |
3261 | 4125 | ||
4126 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<WhitespaceNode<R1>> for WhitespaceNode<R2> { | ||
4127 | fn eq(&self, other: &WhitespaceNode<R1>) -> bool { self.syntax == other.syntax } | ||
4128 | } | ||
4129 | impl<R: TreeRoot<RaTypes>> Eq for WhitespaceNode<R> {} | ||
4130 | impl<R: TreeRoot<RaTypes>> Hash for WhitespaceNode<R> { | ||
4131 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
4132 | } | ||
4133 | |||
3262 | impl<'a> AstNode<'a> for Whitespace<'a> { | 4134 | impl<'a> AstNode<'a> for Whitespace<'a> { |
3263 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | 4135 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { |
3264 | match syntax.kind() { | 4136 | match syntax.kind() { |