diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-31 16:09:31 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-31 16:09:31 +0100 |
commit | 7325283c6977e078513b5b21aa173775e2b22e12 (patch) | |
tree | 7be8b4fbc2e7470bf7891d81b3812eb572bb0d1c /crates | |
parent | ad239f6197bda31f7a9b904b5ccb25c93cbc701a (diff) | |
parent | 633aace41108b74fe6c93c5ab04272067db033f9 (diff) |
Merge #5624
5624: Finalize expressions grammar r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
16 files changed, 704 insertions, 689 deletions
diff --git a/crates/ra_assists/src/handlers/extract_variable.rs b/crates/ra_assists/src/handlers/extract_variable.rs index b925a2884..cc62db0c4 100644 --- a/crates/ra_assists/src/handlers/extract_variable.rs +++ b/crates/ra_assists/src/handlers/extract_variable.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use ra_syntax::{ | 1 | use ra_syntax::{ |
2 | ast::{self, AstNode}, | 2 | ast::{self, AstNode}, |
3 | SyntaxKind::{ | 3 | SyntaxKind::{ |
4 | BLOCK_EXPR, BREAK_EXPR, COMMENT, LAMBDA_EXPR, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR, | 4 | BLOCK_EXPR, BREAK_EXPR, CLOSURE_EXPR, COMMENT, LOOP_EXPR, MATCH_ARM, PATH_EXPR, RETURN_EXPR, |
5 | }, | 5 | }, |
6 | SyntaxNode, | 6 | SyntaxNode, |
7 | }; | 7 | }; |
@@ -148,7 +148,7 @@ impl Anchor { | |||
148 | } | 148 | } |
149 | 149 | ||
150 | if let Some(parent) = node.parent() { | 150 | if let Some(parent) = node.parent() { |
151 | if parent.kind() == MATCH_ARM || parent.kind() == LAMBDA_EXPR { | 151 | if parent.kind() == MATCH_ARM || parent.kind() == CLOSURE_EXPR { |
152 | return Some(Anchor::WrapInBlock(node)); | 152 | return Some(Anchor::WrapInBlock(node)); |
153 | } | 153 | } |
154 | } | 154 | } |
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 5816bf566..99d723402 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -224,9 +224,22 @@ impl ExprCollector<'_> { | |||
224 | self.alloc_expr(Expr::Unsafe { body }, syntax_ptr) | 224 | self.alloc_expr(Expr::Unsafe { body }, syntax_ptr) |
225 | } | 225 | } |
226 | // FIXME: we need to record these effects somewhere... | 226 | // FIXME: we need to record these effects somewhere... |
227 | ast::Effect::Async(_) | ast::Effect::Label(_) => { | 227 | ast::Effect::Label(label) => match e.block_expr() { |
228 | self.collect_block_opt(e.block_expr()) | 228 | Some(block) => { |
229 | } | 229 | let res = self.collect_block(block); |
230 | match &mut self.body.exprs[res] { | ||
231 | Expr::Block { label: block_label, .. } => { | ||
232 | *block_label = | ||
233 | label.lifetime_token().map(|t| Name::new_lifetime(&t)) | ||
234 | } | ||
235 | _ => unreachable!(), | ||
236 | } | ||
237 | res | ||
238 | } | ||
239 | None => self.missing_expr(), | ||
240 | }, | ||
241 | // FIXME: we need to record these effects somewhere... | ||
242 | ast::Effect::Async(_) => self.collect_block_opt(e.block_expr()), | ||
230 | }, | 243 | }, |
231 | ast::Expr::BlockExpr(e) => self.collect_block(e), | 244 | ast::Expr::BlockExpr(e) => self.collect_block(e), |
232 | ast::Expr::LoopExpr(e) => { | 245 | ast::Expr::LoopExpr(e) => { |
@@ -460,7 +473,7 @@ impl ExprCollector<'_> { | |||
460 | self.alloc_expr(Expr::Missing, syntax_ptr) | 473 | self.alloc_expr(Expr::Missing, syntax_ptr) |
461 | } | 474 | } |
462 | } | 475 | } |
463 | ast::Expr::LambdaExpr(e) => { | 476 | ast::Expr::ClosureExpr(e) => { |
464 | let mut args = Vec::new(); | 477 | let mut args = Vec::new(); |
465 | let mut arg_types = Vec::new(); | 478 | let mut arg_types = Vec::new(); |
466 | if let Some(pl) = e.param_list() { | 479 | if let Some(pl) = e.param_list() { |
@@ -618,8 +631,7 @@ impl ExprCollector<'_> { | |||
618 | }) | 631 | }) |
619 | .collect(); | 632 | .collect(); |
620 | let tail = block.expr().map(|e| self.collect_expr(e)); | 633 | let tail = block.expr().map(|e| self.collect_expr(e)); |
621 | let label = block.label().and_then(|l| l.lifetime_token()).map(|t| Name::new_lifetime(&t)); | 634 | self.alloc_expr(Expr::Block { statements, tail, label: None }, syntax_node_ptr) |
622 | self.alloc_expr(Expr::Block { statements, tail, label }, syntax_node_ptr) | ||
623 | } | 635 | } |
624 | 636 | ||
625 | fn collect_block_items(&mut self, block: &ast::BlockExpr) { | 637 | fn collect_block_items(&mut self, block: &ast::BlockExpr) { |
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs index 41df66696..f3b7cd492 100644 --- a/crates/ra_hir_expand/src/db.rs +++ b/crates/ra_hir_expand/src/db.rs | |||
@@ -379,7 +379,7 @@ fn to_fragment_kind(db: &dyn AstDatabase, id: MacroCallId) -> FragmentKind { | |||
379 | 379 | ||
380 | FOR_EXPR => FragmentKind::Expr, | 380 | FOR_EXPR => FragmentKind::Expr, |
381 | PATH_EXPR => FragmentKind::Expr, | 381 | PATH_EXPR => FragmentKind::Expr, |
382 | LAMBDA_EXPR => FragmentKind::Expr, | 382 | CLOSURE_EXPR => FragmentKind::Expr, |
383 | CONDITION => FragmentKind::Expr, | 383 | CONDITION => FragmentKind::Expr, |
384 | BREAK_EXPR => FragmentKind::Expr, | 384 | BREAK_EXPR => FragmentKind::Expr, |
385 | RETURN_EXPR => FragmentKind::Expr, | 385 | RETURN_EXPR => FragmentKind::Expr, |
diff --git a/crates/ra_ide/src/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs index a68861e1c..9e654b373 100644 --- a/crates/ra_ide/src/completion/patterns.rs +++ b/crates/ra_ide/src/completion/patterns.rs | |||
@@ -134,7 +134,7 @@ pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool { | |||
134 | NodeOrToken::Token(token) => token.parent(), | 134 | NodeOrToken::Token(token) => token.parent(), |
135 | }; | 135 | }; |
136 | for node in leaf.ancestors() { | 136 | for node in leaf.ancestors() { |
137 | if node.kind() == FN || node.kind() == LAMBDA_EXPR { | 137 | if node.kind() == FN || node.kind() == CLOSURE_EXPR { |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | let loop_body = match_ast! { | 140 | let loop_body = match_ast! { |
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index 706a2f796..0b01d3bc6 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -250,7 +250,7 @@ fn lambda_expr(p: &mut Parser) -> CompletedMarker { | |||
250 | p.error("expected expression"); | 250 | p.error("expected expression"); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | m.complete(p, LAMBDA_EXPR) | 253 | m.complete(p, CLOSURE_EXPR) |
254 | } | 254 | } |
255 | 255 | ||
256 | // test if_expr | 256 | // test if_expr |
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 64ab18217..2830c0d74 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs | |||
@@ -173,7 +173,7 @@ pub enum SyntaxKind { | |||
173 | ARRAY_EXPR, | 173 | ARRAY_EXPR, |
174 | PAREN_EXPR, | 174 | PAREN_EXPR, |
175 | PATH_EXPR, | 175 | PATH_EXPR, |
176 | LAMBDA_EXPR, | 176 | CLOSURE_EXPR, |
177 | IF_EXPR, | 177 | IF_EXPR, |
178 | WHILE_EXPR, | 178 | WHILE_EXPR, |
179 | CONDITION, | 179 | CONDITION, |
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 763fd20f4..158544fa2 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -349,7 +349,6 @@ pub struct BlockExpr { | |||
349 | } | 349 | } |
350 | impl ast::AttrsOwner for BlockExpr {} | 350 | impl ast::AttrsOwner for BlockExpr {} |
351 | impl BlockExpr { | 351 | impl BlockExpr { |
352 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | ||
353 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 352 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
354 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | 353 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } |
355 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 354 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
@@ -468,6 +467,19 @@ impl ExternItemList { | |||
468 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 467 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
469 | } | 468 | } |
470 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 469 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
470 | pub struct ConstParam { | ||
471 | pub(crate) syntax: SyntaxNode, | ||
472 | } | ||
473 | impl ast::AttrsOwner for ConstParam {} | ||
474 | impl ast::NameOwner for ConstParam {} | ||
475 | impl ConstParam { | ||
476 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
477 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
478 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
479 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
480 | pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
481 | } | ||
482 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
471 | pub struct LifetimeParam { | 483 | pub struct LifetimeParam { |
472 | pub(crate) syntax: SyntaxNode, | 484 | pub(crate) syntax: SyntaxNode, |
473 | } | 485 | } |
@@ -490,19 +502,6 @@ impl TypeParam { | |||
490 | pub fn default_type(&self) -> Option<Type> { support::child(&self.syntax) } | 502 | pub fn default_type(&self) -> Option<Type> { support::child(&self.syntax) } |
491 | } | 503 | } |
492 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 504 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
493 | pub struct ConstParam { | ||
494 | pub(crate) syntax: SyntaxNode, | ||
495 | } | ||
496 | impl ast::AttrsOwner for ConstParam {} | ||
497 | impl ast::NameOwner for ConstParam {} | ||
498 | impl ConstParam { | ||
499 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
500 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
501 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
502 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
503 | pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
504 | } | ||
505 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
506 | pub struct WherePred { | 505 | pub struct WherePred { |
507 | pub(crate) syntax: SyntaxNode, | 506 | pub(crate) syntax: SyntaxNode, |
508 | } | 507 | } |
@@ -519,6 +518,7 @@ impl WherePred { | |||
519 | pub struct Literal { | 518 | pub struct Literal { |
520 | pub(crate) syntax: SyntaxNode, | 519 | pub(crate) syntax: SyntaxNode, |
521 | } | 520 | } |
521 | impl ast::AttrsOwner for Literal {} | ||
522 | impl Literal {} | 522 | impl Literal {} |
523 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 523 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
524 | pub struct TokenTree { | 524 | pub struct TokenTree { |
@@ -533,6 +533,15 @@ impl TokenTree { | |||
533 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 533 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
534 | } | 534 | } |
535 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 535 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
536 | pub struct ExprStmt { | ||
537 | pub(crate) syntax: SyntaxNode, | ||
538 | } | ||
539 | impl ast::AttrsOwner for ExprStmt {} | ||
540 | impl ExprStmt { | ||
541 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
542 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
543 | } | ||
544 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
536 | pub struct LetStmt { | 545 | pub struct LetStmt { |
537 | pub(crate) syntax: SyntaxNode, | 546 | pub(crate) syntax: SyntaxNode, |
538 | } | 547 | } |
@@ -547,165 +556,191 @@ impl LetStmt { | |||
547 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 556 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
548 | } | 557 | } |
549 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 558 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
550 | pub struct ExprStmt { | 559 | pub struct ArrayExpr { |
551 | pub(crate) syntax: SyntaxNode, | 560 | pub(crate) syntax: SyntaxNode, |
552 | } | 561 | } |
553 | impl ast::AttrsOwner for ExprStmt {} | 562 | impl ast::AttrsOwner for ArrayExpr {} |
554 | impl ExprStmt { | 563 | impl ArrayExpr { |
564 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
565 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | ||
555 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 566 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
556 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 567 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
568 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
557 | } | 569 | } |
558 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 570 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
559 | pub struct ParenType { | 571 | pub struct AwaitExpr { |
560 | pub(crate) syntax: SyntaxNode, | ||
561 | } | ||
562 | impl ParenType { | ||
563 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
564 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
565 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
566 | } | ||
567 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
568 | pub struct TupleType { | ||
569 | pub(crate) syntax: SyntaxNode, | 572 | pub(crate) syntax: SyntaxNode, |
570 | } | 573 | } |
571 | impl TupleType { | 574 | impl ast::AttrsOwner for AwaitExpr {} |
572 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 575 | impl AwaitExpr { |
573 | pub fn fields(&self) -> AstChildren<Type> { support::children(&self.syntax) } | 576 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
574 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 577 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } |
578 | pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) } | ||
575 | } | 579 | } |
576 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 580 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
577 | pub struct NeverType { | 581 | pub struct BinExpr { |
578 | pub(crate) syntax: SyntaxNode, | 582 | pub(crate) syntax: SyntaxNode, |
579 | } | 583 | } |
580 | impl NeverType { | 584 | impl ast::AttrsOwner for BinExpr {} |
581 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | 585 | impl BinExpr {} |
582 | } | ||
583 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 586 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
584 | pub struct PathType { | 587 | pub struct BoxExpr { |
585 | pub(crate) syntax: SyntaxNode, | 588 | pub(crate) syntax: SyntaxNode, |
586 | } | 589 | } |
587 | impl PathType { | 590 | impl ast::AttrsOwner for BoxExpr {} |
588 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 591 | impl BoxExpr { |
592 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } | ||
593 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
589 | } | 594 | } |
590 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 595 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
591 | pub struct PointerType { | 596 | pub struct BreakExpr { |
592 | pub(crate) syntax: SyntaxNode, | 597 | pub(crate) syntax: SyntaxNode, |
593 | } | 598 | } |
594 | impl PointerType { | 599 | impl ast::AttrsOwner for BreakExpr {} |
595 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } | 600 | impl BreakExpr { |
596 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | 601 | pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } |
597 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 602 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
598 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | 603 | support::token(&self.syntax, T![lifetime]) |
604 | } | ||
605 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
599 | } | 606 | } |
600 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 607 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
601 | pub struct ArrayType { | 608 | pub struct CallExpr { |
602 | pub(crate) syntax: SyntaxNode, | 609 | pub(crate) syntax: SyntaxNode, |
603 | } | 610 | } |
604 | impl ArrayType { | 611 | impl ast::AttrsOwner for CallExpr {} |
605 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 612 | impl ast::ArgListOwner for CallExpr {} |
606 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | 613 | impl CallExpr { |
607 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
608 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 614 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
609 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
610 | } | 615 | } |
611 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 616 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
612 | pub struct SliceType { | 617 | pub struct CastExpr { |
613 | pub(crate) syntax: SyntaxNode, | 618 | pub(crate) syntax: SyntaxNode, |
614 | } | 619 | } |
615 | impl SliceType { | 620 | impl ast::AttrsOwner for CastExpr {} |
616 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 621 | impl CastExpr { |
622 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
623 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | ||
617 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | 624 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
618 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
619 | } | 625 | } |
620 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 626 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
621 | pub struct ReferenceType { | 627 | pub struct ContinueExpr { |
622 | pub(crate) syntax: SyntaxNode, | 628 | pub(crate) syntax: SyntaxNode, |
623 | } | 629 | } |
624 | impl ReferenceType { | 630 | impl ast::AttrsOwner for ContinueExpr {} |
625 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | 631 | impl ContinueExpr { |
632 | pub fn continue_token(&self) -> Option<SyntaxToken> { | ||
633 | support::token(&self.syntax, T![continue]) | ||
634 | } | ||
626 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | 635 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
627 | support::token(&self.syntax, T![lifetime]) | 636 | support::token(&self.syntax, T![lifetime]) |
628 | } | 637 | } |
629 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
630 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
631 | } | 638 | } |
632 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 639 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
633 | pub struct InferType { | 640 | pub struct EffectExpr { |
634 | pub(crate) syntax: SyntaxNode, | 641 | pub(crate) syntax: SyntaxNode, |
635 | } | 642 | } |
636 | impl InferType { | 643 | impl ast::AttrsOwner for EffectExpr {} |
637 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | 644 | impl EffectExpr { |
645 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | ||
646 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } | ||
647 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
648 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | ||
649 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | ||
638 | } | 650 | } |
639 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 651 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
640 | pub struct FnPointerType { | 652 | pub struct FieldExpr { |
641 | pub(crate) syntax: SyntaxNode, | 653 | pub(crate) syntax: SyntaxNode, |
642 | } | 654 | } |
643 | impl FnPointerType { | 655 | impl ast::AttrsOwner for FieldExpr {} |
644 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | 656 | impl FieldExpr { |
645 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | 657 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
646 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | 658 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } |
647 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | 659 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
648 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } | ||
649 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
650 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
651 | } | 660 | } |
652 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 661 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
653 | pub struct ForType { | 662 | pub struct ForExpr { |
654 | pub(crate) syntax: SyntaxNode, | 663 | pub(crate) syntax: SyntaxNode, |
655 | } | 664 | } |
656 | impl ForType { | 665 | impl ast::AttrsOwner for ForExpr {} |
666 | impl ast::LoopBodyOwner for ForExpr {} | ||
667 | impl ForExpr { | ||
657 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | 668 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
658 | pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } | 669 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
659 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | 670 | pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } |
671 | pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
660 | } | 672 | } |
661 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 673 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
662 | pub struct ImplTraitType { | 674 | pub struct IfExpr { |
663 | pub(crate) syntax: SyntaxNode, | 675 | pub(crate) syntax: SyntaxNode, |
664 | } | 676 | } |
665 | impl ImplTraitType { | 677 | impl ast::AttrsOwner for IfExpr {} |
666 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } | 678 | impl IfExpr { |
667 | pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } | 679 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } |
680 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | ||
681 | pub fn else_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![else]) } | ||
668 | } | 682 | } |
669 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 683 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
670 | pub struct DynTraitType { | 684 | pub struct IndexExpr { |
671 | pub(crate) syntax: SyntaxNode, | 685 | pub(crate) syntax: SyntaxNode, |
672 | } | 686 | } |
673 | impl DynTraitType { | 687 | impl ast::AttrsOwner for IndexExpr {} |
674 | pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } | 688 | impl IndexExpr { |
675 | pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } | 689 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
690 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
676 | } | 691 | } |
677 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 692 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
678 | pub struct TypeBound { | 693 | pub struct Label { |
679 | pub(crate) syntax: SyntaxNode, | 694 | pub(crate) syntax: SyntaxNode, |
680 | } | 695 | } |
681 | impl TypeBound { | 696 | impl Label { |
682 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | 697 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
683 | support::token(&self.syntax, T![lifetime]) | 698 | support::token(&self.syntax, T![lifetime]) |
684 | } | 699 | } |
685 | pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } | ||
686 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
687 | } | 700 | } |
688 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 701 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
689 | pub struct TupleExpr { | 702 | pub struct ClosureExpr { |
690 | pub(crate) syntax: SyntaxNode, | 703 | pub(crate) syntax: SyntaxNode, |
691 | } | 704 | } |
692 | impl ast::AttrsOwner for TupleExpr {} | 705 | impl ast::AttrsOwner for ClosureExpr {} |
693 | impl TupleExpr { | 706 | impl ClosureExpr { |
694 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 707 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } |
695 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | 708 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } |
696 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 709 | pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } |
710 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
711 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
712 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
697 | } | 713 | } |
698 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 714 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
699 | pub struct ArrayExpr { | 715 | pub struct LoopExpr { |
700 | pub(crate) syntax: SyntaxNode, | 716 | pub(crate) syntax: SyntaxNode, |
701 | } | 717 | } |
702 | impl ast::AttrsOwner for ArrayExpr {} | 718 | impl ast::AttrsOwner for LoopExpr {} |
703 | impl ArrayExpr { | 719 | impl ast::LoopBodyOwner for LoopExpr {} |
704 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 720 | impl LoopExpr { |
705 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } | 721 | pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } |
722 | } | ||
723 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
724 | pub struct MatchExpr { | ||
725 | pub(crate) syntax: SyntaxNode, | ||
726 | } | ||
727 | impl ast::AttrsOwner for MatchExpr {} | ||
728 | impl MatchExpr { | ||
729 | pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } | ||
706 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 730 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
707 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 731 | pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } |
708 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 732 | } |
733 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
734 | pub struct MethodCallExpr { | ||
735 | pub(crate) syntax: SyntaxNode, | ||
736 | } | ||
737 | impl ast::AttrsOwner for MethodCallExpr {} | ||
738 | impl ast::ArgListOwner for MethodCallExpr {} | ||
739 | impl MethodCallExpr { | ||
740 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
741 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
742 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
743 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | ||
709 | } | 744 | } |
710 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 745 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
711 | pub struct ParenExpr { | 746 | pub struct ParenExpr { |
@@ -721,82 +756,73 @@ impl ParenExpr { | |||
721 | pub struct PathExpr { | 756 | pub struct PathExpr { |
722 | pub(crate) syntax: SyntaxNode, | 757 | pub(crate) syntax: SyntaxNode, |
723 | } | 758 | } |
759 | impl ast::AttrsOwner for PathExpr {} | ||
724 | impl PathExpr { | 760 | impl PathExpr { |
725 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 761 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
726 | } | 762 | } |
727 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 763 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
728 | pub struct LambdaExpr { | 764 | pub struct PrefixExpr { |
729 | pub(crate) syntax: SyntaxNode, | 765 | pub(crate) syntax: SyntaxNode, |
730 | } | 766 | } |
731 | impl ast::AttrsOwner for LambdaExpr {} | 767 | impl ast::AttrsOwner for PrefixExpr {} |
732 | impl LambdaExpr { | 768 | impl PrefixExpr { |
733 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } | 769 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
734 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | ||
735 | pub fn move_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![move]) } | ||
736 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
737 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
738 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
739 | } | 770 | } |
740 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 771 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
741 | pub struct IfExpr { | 772 | pub struct RangeExpr { |
742 | pub(crate) syntax: SyntaxNode, | 773 | pub(crate) syntax: SyntaxNode, |
743 | } | 774 | } |
744 | impl ast::AttrsOwner for IfExpr {} | 775 | impl ast::AttrsOwner for RangeExpr {} |
745 | impl IfExpr { | 776 | impl RangeExpr {} |
746 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } | ||
747 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | ||
748 | } | ||
749 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 777 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
750 | pub struct Condition { | 778 | pub struct RecordExpr { |
751 | pub(crate) syntax: SyntaxNode, | 779 | pub(crate) syntax: SyntaxNode, |
752 | } | 780 | } |
753 | impl Condition { | 781 | impl RecordExpr { |
754 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } | 782 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
755 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 783 | pub fn record_expr_field_list(&self) -> Option<RecordExprFieldList> { |
756 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 784 | support::child(&self.syntax) |
757 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 785 | } |
758 | } | 786 | } |
759 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 787 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
760 | pub struct EffectExpr { | 788 | pub struct RefExpr { |
761 | pub(crate) syntax: SyntaxNode, | 789 | pub(crate) syntax: SyntaxNode, |
762 | } | 790 | } |
763 | impl ast::AttrsOwner for EffectExpr {} | 791 | impl ast::AttrsOwner for RefExpr {} |
764 | impl EffectExpr { | 792 | impl RefExpr { |
765 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | 793 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
766 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } | 794 | pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } |
767 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | 795 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
768 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | 796 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
769 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | 797 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
770 | } | 798 | } |
771 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 799 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
772 | pub struct Label { | 800 | pub struct ReturnExpr { |
773 | pub(crate) syntax: SyntaxNode, | 801 | pub(crate) syntax: SyntaxNode, |
774 | } | 802 | } |
775 | impl Label { | 803 | impl ast::AttrsOwner for ReturnExpr {} |
776 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | 804 | impl ReturnExpr { |
777 | support::token(&self.syntax, T![lifetime]) | 805 | pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) } |
778 | } | 806 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
779 | } | 807 | } |
780 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 808 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
781 | pub struct LoopExpr { | 809 | pub struct TryExpr { |
782 | pub(crate) syntax: SyntaxNode, | 810 | pub(crate) syntax: SyntaxNode, |
783 | } | 811 | } |
784 | impl ast::AttrsOwner for LoopExpr {} | 812 | impl ast::AttrsOwner for TryExpr {} |
785 | impl ast::LoopBodyOwner for LoopExpr {} | 813 | impl TryExpr { |
786 | impl LoopExpr { | 814 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
787 | pub fn loop_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![loop]) } | 815 | pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } |
788 | } | 816 | } |
789 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 817 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
790 | pub struct ForExpr { | 818 | pub struct TupleExpr { |
791 | pub(crate) syntax: SyntaxNode, | 819 | pub(crate) syntax: SyntaxNode, |
792 | } | 820 | } |
793 | impl ast::AttrsOwner for ForExpr {} | 821 | impl ast::AttrsOwner for TupleExpr {} |
794 | impl ast::LoopBodyOwner for ForExpr {} | 822 | impl TupleExpr { |
795 | impl ForExpr { | 823 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
796 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | 824 | pub fn exprs(&self) -> AstChildren<Expr> { support::children(&self.syntax) } |
797 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 825 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
798 | pub fn in_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![in]) } | ||
799 | pub fn iterable(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
800 | } | 826 | } |
801 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 827 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
802 | pub struct WhileExpr { | 828 | pub struct WhileExpr { |
@@ -809,46 +835,25 @@ impl WhileExpr { | |||
809 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } | 835 | pub fn condition(&self) -> Option<Condition> { support::child(&self.syntax) } |
810 | } | 836 | } |
811 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 837 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
812 | pub struct ContinueExpr { | 838 | pub struct RecordExprFieldList { |
813 | pub(crate) syntax: SyntaxNode, | ||
814 | } | ||
815 | impl ast::AttrsOwner for ContinueExpr {} | ||
816 | impl ContinueExpr { | ||
817 | pub fn continue_token(&self) -> Option<SyntaxToken> { | ||
818 | support::token(&self.syntax, T![continue]) | ||
819 | } | ||
820 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
821 | support::token(&self.syntax, T![lifetime]) | ||
822 | } | ||
823 | } | ||
824 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
825 | pub struct BreakExpr { | ||
826 | pub(crate) syntax: SyntaxNode, | ||
827 | } | ||
828 | impl ast::AttrsOwner for BreakExpr {} | ||
829 | impl BreakExpr { | ||
830 | pub fn break_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![break]) } | ||
831 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
832 | support::token(&self.syntax, T![lifetime]) | ||
833 | } | ||
834 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
835 | } | ||
836 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
837 | pub struct ReturnExpr { | ||
838 | pub(crate) syntax: SyntaxNode, | 839 | pub(crate) syntax: SyntaxNode, |
839 | } | 840 | } |
840 | impl ast::AttrsOwner for ReturnExpr {} | 841 | impl ast::AttrsOwner for RecordExprFieldList {} |
841 | impl ReturnExpr { | 842 | impl RecordExprFieldList { |
842 | pub fn return_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![return]) } | 843 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
843 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 844 | pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) } |
845 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | ||
846 | pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
847 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
844 | } | 848 | } |
845 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 849 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
846 | pub struct CallExpr { | 850 | pub struct RecordExprField { |
847 | pub(crate) syntax: SyntaxNode, | 851 | pub(crate) syntax: SyntaxNode, |
848 | } | 852 | } |
849 | impl ast::AttrsOwner for CallExpr {} | 853 | impl ast::AttrsOwner for RecordExprField {} |
850 | impl ast::ArgListOwner for CallExpr {} | 854 | impl RecordExprField { |
851 | impl CallExpr { | 855 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
856 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
852 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 857 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
853 | } | 858 | } |
854 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 859 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -861,18 +866,6 @@ impl ArgList { | |||
861 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 866 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
862 | } | 867 | } |
863 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 868 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
864 | pub struct MethodCallExpr { | ||
865 | pub(crate) syntax: SyntaxNode, | ||
866 | } | ||
867 | impl ast::AttrsOwner for MethodCallExpr {} | ||
868 | impl ast::ArgListOwner for MethodCallExpr {} | ||
869 | impl MethodCallExpr { | ||
870 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
871 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
872 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
873 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | ||
874 | } | ||
875 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
876 | pub struct TypeArgList { | 869 | pub struct TypeArgList { |
877 | pub(crate) syntax: SyntaxNode, | 870 | pub(crate) syntax: SyntaxNode, |
878 | } | 871 | } |
@@ -886,162 +879,174 @@ impl TypeArgList { | |||
886 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | 879 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } |
887 | } | 880 | } |
888 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 881 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
889 | pub struct FieldExpr { | 882 | pub struct Condition { |
890 | pub(crate) syntax: SyntaxNode, | 883 | pub(crate) syntax: SyntaxNode, |
891 | } | 884 | } |
892 | impl ast::AttrsOwner for FieldExpr {} | 885 | impl Condition { |
893 | impl FieldExpr { | 886 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } |
887 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
888 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
894 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 889 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
895 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | ||
896 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | ||
897 | } | 890 | } |
898 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 891 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
899 | pub struct IndexExpr { | 892 | pub struct MatchArmList { |
900 | pub(crate) syntax: SyntaxNode, | 893 | pub(crate) syntax: SyntaxNode, |
901 | } | 894 | } |
902 | impl ast::AttrsOwner for IndexExpr {} | 895 | impl ast::AttrsOwner for MatchArmList {} |
903 | impl IndexExpr { | 896 | impl MatchArmList { |
904 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 897 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
905 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 898 | pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } |
899 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
906 | } | 900 | } |
907 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 901 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
908 | pub struct AwaitExpr { | 902 | pub struct MatchArm { |
909 | pub(crate) syntax: SyntaxNode, | 903 | pub(crate) syntax: SyntaxNode, |
910 | } | 904 | } |
911 | impl ast::AttrsOwner for AwaitExpr {} | 905 | impl ast::AttrsOwner for MatchArm {} |
912 | impl AwaitExpr { | 906 | impl MatchArm { |
907 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
908 | pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } | ||
909 | pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } | ||
913 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 910 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
914 | pub fn dot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![.]) } | 911 | pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } |
915 | pub fn await_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![await]) } | ||
916 | } | 912 | } |
917 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 913 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
918 | pub struct TryExpr { | 914 | pub struct MatchGuard { |
919 | pub(crate) syntax: SyntaxNode, | 915 | pub(crate) syntax: SyntaxNode, |
920 | } | 916 | } |
921 | impl ast::AttrsOwner for TryExpr {} | 917 | impl MatchGuard { |
922 | impl TryExpr { | 918 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } |
923 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 919 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
924 | pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } | ||
925 | } | 920 | } |
926 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 921 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
927 | pub struct CastExpr { | 922 | pub struct ArrayType { |
928 | pub(crate) syntax: SyntaxNode, | 923 | pub(crate) syntax: SyntaxNode, |
929 | } | 924 | } |
930 | impl ast::AttrsOwner for CastExpr {} | 925 | impl ArrayType { |
931 | impl CastExpr { | 926 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
932 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
933 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | ||
934 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | 927 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
928 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | ||
929 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
930 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
935 | } | 931 | } |
936 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 932 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
937 | pub struct RefExpr { | 933 | pub struct DynTraitType { |
938 | pub(crate) syntax: SyntaxNode, | 934 | pub(crate) syntax: SyntaxNode, |
939 | } | 935 | } |
940 | impl ast::AttrsOwner for RefExpr {} | 936 | impl DynTraitType { |
941 | impl RefExpr { | 937 | pub fn dyn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![dyn]) } |
942 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | 938 | pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } |
943 | pub fn raw_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![raw]) } | ||
944 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
945 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
946 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
947 | } | 939 | } |
948 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 940 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
949 | pub struct PrefixExpr { | 941 | pub struct FnPointerType { |
950 | pub(crate) syntax: SyntaxNode, | 942 | pub(crate) syntax: SyntaxNode, |
951 | } | 943 | } |
952 | impl ast::AttrsOwner for PrefixExpr {} | 944 | impl FnPointerType { |
953 | impl PrefixExpr { | 945 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
954 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 946 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } |
947 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
948 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | ||
949 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } | ||
950 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | ||
951 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | ||
955 | } | 952 | } |
956 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 953 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
957 | pub struct BoxExpr { | 954 | pub struct ForType { |
958 | pub(crate) syntax: SyntaxNode, | 955 | pub(crate) syntax: SyntaxNode, |
959 | } | 956 | } |
960 | impl ast::AttrsOwner for BoxExpr {} | 957 | impl ForType { |
961 | impl BoxExpr { | 958 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
962 | pub fn box_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![box]) } | 959 | pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } |
963 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 960 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
964 | } | 961 | } |
965 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 962 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
966 | pub struct RangeExpr { | 963 | pub struct ImplTraitType { |
967 | pub(crate) syntax: SyntaxNode, | 964 | pub(crate) syntax: SyntaxNode, |
968 | } | 965 | } |
969 | impl ast::AttrsOwner for RangeExpr {} | 966 | impl ImplTraitType { |
970 | impl RangeExpr {} | 967 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } |
968 | pub fn type_bound_list(&self) -> Option<TypeBoundList> { support::child(&self.syntax) } | ||
969 | } | ||
971 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 970 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
972 | pub struct BinExpr { | 971 | pub struct InferType { |
973 | pub(crate) syntax: SyntaxNode, | 972 | pub(crate) syntax: SyntaxNode, |
974 | } | 973 | } |
975 | impl ast::AttrsOwner for BinExpr {} | 974 | impl InferType { |
976 | impl BinExpr {} | 975 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } |
976 | } | ||
977 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 977 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
978 | pub struct MatchExpr { | 978 | pub struct NeverType { |
979 | pub(crate) syntax: SyntaxNode, | 979 | pub(crate) syntax: SyntaxNode, |
980 | } | 980 | } |
981 | impl ast::AttrsOwner for MatchExpr {} | 981 | impl NeverType { |
982 | impl MatchExpr { | 982 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
983 | pub fn match_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![match]) } | ||
984 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
985 | pub fn match_arm_list(&self) -> Option<MatchArmList> { support::child(&self.syntax) } | ||
986 | } | 983 | } |
987 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 984 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
988 | pub struct MatchArmList { | 985 | pub struct ParenType { |
989 | pub(crate) syntax: SyntaxNode, | 986 | pub(crate) syntax: SyntaxNode, |
990 | } | 987 | } |
991 | impl MatchArmList { | 988 | impl ParenType { |
992 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 989 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
993 | pub fn arms(&self) -> AstChildren<MatchArm> { support::children(&self.syntax) } | 990 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
994 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 991 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
995 | } | 992 | } |
996 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 993 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
997 | pub struct MatchArm { | 994 | pub struct PathType { |
998 | pub(crate) syntax: SyntaxNode, | 995 | pub(crate) syntax: SyntaxNode, |
999 | } | 996 | } |
1000 | impl ast::AttrsOwner for MatchArm {} | 997 | impl PathType { |
1001 | impl MatchArm { | 998 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
1002 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1003 | pub fn guard(&self) -> Option<MatchGuard> { support::child(&self.syntax) } | ||
1004 | pub fn fat_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=>]) } | ||
1005 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1006 | } | 999 | } |
1007 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1000 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1008 | pub struct MatchGuard { | 1001 | pub struct PointerType { |
1009 | pub(crate) syntax: SyntaxNode, | 1002 | pub(crate) syntax: SyntaxNode, |
1010 | } | 1003 | } |
1011 | impl MatchGuard { | 1004 | impl PointerType { |
1012 | pub fn if_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![if]) } | 1005 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } |
1013 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1006 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
1007 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
1008 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
1014 | } | 1009 | } |
1015 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1010 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1016 | pub struct RecordExpr { | 1011 | pub struct ReferenceType { |
1017 | pub(crate) syntax: SyntaxNode, | 1012 | pub(crate) syntax: SyntaxNode, |
1018 | } | 1013 | } |
1019 | impl RecordExpr { | 1014 | impl ReferenceType { |
1020 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 1015 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } |
1021 | pub fn record_expr_field_list(&self) -> Option<RecordExprFieldList> { | 1016 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
1022 | support::child(&self.syntax) | 1017 | support::token(&self.syntax, T![lifetime]) |
1023 | } | 1018 | } |
1019 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
1020 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
1024 | } | 1021 | } |
1025 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1022 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1026 | pub struct RecordExprFieldList { | 1023 | pub struct SliceType { |
1027 | pub(crate) syntax: SyntaxNode, | 1024 | pub(crate) syntax: SyntaxNode, |
1028 | } | 1025 | } |
1029 | impl RecordExprFieldList { | 1026 | impl SliceType { |
1030 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 1027 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
1031 | pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) } | 1028 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } |
1032 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | 1029 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
1033 | pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1034 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1035 | } | 1030 | } |
1036 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1031 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1037 | pub struct RecordExprField { | 1032 | pub struct TupleType { |
1038 | pub(crate) syntax: SyntaxNode, | 1033 | pub(crate) syntax: SyntaxNode, |
1039 | } | 1034 | } |
1040 | impl ast::AttrsOwner for RecordExprField {} | 1035 | impl TupleType { |
1041 | impl RecordExprField { | 1036 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
1042 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 1037 | pub fn fields(&self) -> AstChildren<Type> { support::children(&self.syntax) } |
1043 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 1038 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
1044 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1039 | } |
1040 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1041 | pub struct TypeBound { | ||
1042 | pub(crate) syntax: SyntaxNode, | ||
1043 | } | ||
1044 | impl TypeBound { | ||
1045 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1046 | support::token(&self.syntax, T![lifetime]) | ||
1047 | } | ||
1048 | pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } | ||
1049 | pub fn ty(&self) -> Option<Type> { support::child(&self.syntax) } | ||
1045 | } | 1050 | } |
1046 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1051 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1047 | pub struct OrPat { | 1052 | pub struct OrPat { |
@@ -1285,19 +1290,19 @@ pub enum Item { | |||
1285 | impl ast::AttrsOwner for Item {} | 1290 | impl ast::AttrsOwner for Item {} |
1286 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1291 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1287 | pub enum Type { | 1292 | pub enum Type { |
1288 | ParenType(ParenType), | ||
1289 | TupleType(TupleType), | ||
1290 | NeverType(NeverType), | ||
1291 | PathType(PathType), | ||
1292 | PointerType(PointerType), | ||
1293 | ArrayType(ArrayType), | 1293 | ArrayType(ArrayType), |
1294 | SliceType(SliceType), | 1294 | DynTraitType(DynTraitType), |
1295 | ReferenceType(ReferenceType), | ||
1296 | InferType(InferType), | ||
1297 | FnPointerType(FnPointerType), | 1295 | FnPointerType(FnPointerType), |
1298 | ForType(ForType), | 1296 | ForType(ForType), |
1299 | ImplTraitType(ImplTraitType), | 1297 | ImplTraitType(ImplTraitType), |
1300 | DynTraitType(DynTraitType), | 1298 | InferType(InferType), |
1299 | NeverType(NeverType), | ||
1300 | ParenType(ParenType), | ||
1301 | PathType(PathType), | ||
1302 | PointerType(PointerType), | ||
1303 | ReferenceType(ReferenceType), | ||
1304 | SliceType(SliceType), | ||
1305 | TupleType(TupleType), | ||
1301 | } | 1306 | } |
1302 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1307 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1303 | pub enum Pat { | 1308 | pub enum Pat { |
@@ -1324,42 +1329,42 @@ pub enum FieldList { | |||
1324 | } | 1329 | } |
1325 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1330 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1326 | pub enum Expr { | 1331 | pub enum Expr { |
1327 | TupleExpr(TupleExpr), | ||
1328 | ArrayExpr(ArrayExpr), | 1332 | ArrayExpr(ArrayExpr), |
1329 | ParenExpr(ParenExpr), | 1333 | AwaitExpr(AwaitExpr), |
1330 | PathExpr(PathExpr), | 1334 | BinExpr(BinExpr), |
1331 | LambdaExpr(LambdaExpr), | ||
1332 | IfExpr(IfExpr), | ||
1333 | LoopExpr(LoopExpr), | ||
1334 | ForExpr(ForExpr), | ||
1335 | WhileExpr(WhileExpr), | ||
1336 | ContinueExpr(ContinueExpr), | ||
1337 | BreakExpr(BreakExpr), | ||
1338 | Label(Label), | ||
1339 | BlockExpr(BlockExpr), | 1335 | BlockExpr(BlockExpr), |
1340 | ReturnExpr(ReturnExpr), | 1336 | BoxExpr(BoxExpr), |
1341 | MatchExpr(MatchExpr), | 1337 | BreakExpr(BreakExpr), |
1342 | RecordExpr(RecordExpr), | ||
1343 | CallExpr(CallExpr), | 1338 | CallExpr(CallExpr), |
1339 | CastExpr(CastExpr), | ||
1340 | ContinueExpr(ContinueExpr), | ||
1341 | EffectExpr(EffectExpr), | ||
1342 | FieldExpr(FieldExpr), | ||
1343 | ForExpr(ForExpr), | ||
1344 | IfExpr(IfExpr), | ||
1344 | IndexExpr(IndexExpr), | 1345 | IndexExpr(IndexExpr), |
1346 | Label(Label), | ||
1347 | ClosureExpr(ClosureExpr), | ||
1348 | Literal(Literal), | ||
1349 | LoopExpr(LoopExpr), | ||
1350 | MacroCall(MacroCall), | ||
1351 | MatchExpr(MatchExpr), | ||
1345 | MethodCallExpr(MethodCallExpr), | 1352 | MethodCallExpr(MethodCallExpr), |
1346 | FieldExpr(FieldExpr), | 1353 | ParenExpr(ParenExpr), |
1347 | AwaitExpr(AwaitExpr), | 1354 | PathExpr(PathExpr), |
1348 | TryExpr(TryExpr), | ||
1349 | EffectExpr(EffectExpr), | ||
1350 | CastExpr(CastExpr), | ||
1351 | RefExpr(RefExpr), | ||
1352 | PrefixExpr(PrefixExpr), | 1355 | PrefixExpr(PrefixExpr), |
1353 | RangeExpr(RangeExpr), | 1356 | RangeExpr(RangeExpr), |
1354 | BinExpr(BinExpr), | 1357 | RecordExpr(RecordExpr), |
1355 | Literal(Literal), | 1358 | RefExpr(RefExpr), |
1356 | MacroCall(MacroCall), | 1359 | ReturnExpr(ReturnExpr), |
1357 | BoxExpr(BoxExpr), | 1360 | TryExpr(TryExpr), |
1361 | TupleExpr(TupleExpr), | ||
1362 | WhileExpr(WhileExpr), | ||
1358 | } | 1363 | } |
1359 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1364 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1360 | pub enum AdtDef { | 1365 | pub enum AdtDef { |
1361 | Struct(Struct), | ||
1362 | Enum(Enum), | 1366 | Enum(Enum), |
1367 | Struct(Struct), | ||
1363 | Union(Union), | 1368 | Union(Union), |
1364 | } | 1369 | } |
1365 | impl ast::AttrsOwner for AdtDef {} | 1370 | impl ast::AttrsOwner for AdtDef {} |
@@ -1368,10 +1373,10 @@ impl ast::NameOwner for AdtDef {} | |||
1368 | impl ast::VisibilityOwner for AdtDef {} | 1373 | impl ast::VisibilityOwner for AdtDef {} |
1369 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1374 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1370 | pub enum AssocItem { | 1375 | pub enum AssocItem { |
1371 | Fn(Fn), | ||
1372 | TypeAlias(TypeAlias), | ||
1373 | Const(Const), | 1376 | Const(Const), |
1377 | Fn(Fn), | ||
1374 | MacroCall(MacroCall), | 1378 | MacroCall(MacroCall), |
1379 | TypeAlias(TypeAlias), | ||
1375 | } | 1380 | } |
1376 | impl ast::AttrsOwner for AssocItem {} | 1381 | impl ast::AttrsOwner for AssocItem {} |
1377 | impl ast::NameOwner for AssocItem {} | 1382 | impl ast::NameOwner for AssocItem {} |
@@ -1385,16 +1390,16 @@ impl ast::AttrsOwner for ExternItem {} | |||
1385 | impl ast::NameOwner for ExternItem {} | 1390 | impl ast::NameOwner for ExternItem {} |
1386 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1391 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1387 | pub enum GenericParam { | 1392 | pub enum GenericParam { |
1393 | ConstParam(ConstParam), | ||
1388 | LifetimeParam(LifetimeParam), | 1394 | LifetimeParam(LifetimeParam), |
1389 | TypeParam(TypeParam), | 1395 | TypeParam(TypeParam), |
1390 | ConstParam(ConstParam), | ||
1391 | } | 1396 | } |
1392 | impl ast::AttrsOwner for GenericParam {} | 1397 | impl ast::AttrsOwner for GenericParam {} |
1393 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1398 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1394 | pub enum Stmt { | 1399 | pub enum Stmt { |
1395 | LetStmt(LetStmt), | ||
1396 | ExprStmt(ExprStmt), | 1400 | ExprStmt(ExprStmt), |
1397 | Item(Item), | 1401 | Item(Item), |
1402 | LetStmt(LetStmt), | ||
1398 | } | 1403 | } |
1399 | impl AstNode for SourceFile { | 1404 | impl AstNode for SourceFile { |
1400 | fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } | 1405 | fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } |
@@ -1847,8 +1852,8 @@ impl AstNode for ExternItemList { | |||
1847 | } | 1852 | } |
1848 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1853 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1849 | } | 1854 | } |
1850 | impl AstNode for LifetimeParam { | 1855 | impl AstNode for ConstParam { |
1851 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } | 1856 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } |
1852 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1857 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1853 | if Self::can_cast(syntax.kind()) { | 1858 | if Self::can_cast(syntax.kind()) { |
1854 | Some(Self { syntax }) | 1859 | Some(Self { syntax }) |
@@ -1858,8 +1863,8 @@ impl AstNode for LifetimeParam { | |||
1858 | } | 1863 | } |
1859 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1864 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1860 | } | 1865 | } |
1861 | impl AstNode for TypeParam { | 1866 | impl AstNode for LifetimeParam { |
1862 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } | 1867 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } |
1863 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1868 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1864 | if Self::can_cast(syntax.kind()) { | 1869 | if Self::can_cast(syntax.kind()) { |
1865 | Some(Self { syntax }) | 1870 | Some(Self { syntax }) |
@@ -1869,8 +1874,8 @@ impl AstNode for TypeParam { | |||
1869 | } | 1874 | } |
1870 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1875 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1871 | } | 1876 | } |
1872 | impl AstNode for ConstParam { | 1877 | impl AstNode for TypeParam { |
1873 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } | 1878 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } |
1874 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1879 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1875 | if Self::can_cast(syntax.kind()) { | 1880 | if Self::can_cast(syntax.kind()) { |
1876 | Some(Self { syntax }) | 1881 | Some(Self { syntax }) |
@@ -1913,8 +1918,8 @@ impl AstNode for TokenTree { | |||
1913 | } | 1918 | } |
1914 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1919 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1915 | } | 1920 | } |
1916 | impl AstNode for LetStmt { | 1921 | impl AstNode for ExprStmt { |
1917 | fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT } | 1922 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } |
1918 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1923 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1919 | if Self::can_cast(syntax.kind()) { | 1924 | if Self::can_cast(syntax.kind()) { |
1920 | Some(Self { syntax }) | 1925 | Some(Self { syntax }) |
@@ -1924,8 +1929,8 @@ impl AstNode for LetStmt { | |||
1924 | } | 1929 | } |
1925 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1930 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1926 | } | 1931 | } |
1927 | impl AstNode for ExprStmt { | 1932 | impl AstNode for LetStmt { |
1928 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXPR_STMT } | 1933 | fn can_cast(kind: SyntaxKind) -> bool { kind == LET_STMT } |
1929 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1934 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1930 | if Self::can_cast(syntax.kind()) { | 1935 | if Self::can_cast(syntax.kind()) { |
1931 | Some(Self { syntax }) | 1936 | Some(Self { syntax }) |
@@ -1935,8 +1940,8 @@ impl AstNode for ExprStmt { | |||
1935 | } | 1940 | } |
1936 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1941 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1937 | } | 1942 | } |
1938 | impl AstNode for ParenType { | 1943 | impl AstNode for ArrayExpr { |
1939 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } | 1944 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR } |
1940 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1945 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1941 | if Self::can_cast(syntax.kind()) { | 1946 | if Self::can_cast(syntax.kind()) { |
1942 | Some(Self { syntax }) | 1947 | Some(Self { syntax }) |
@@ -1946,8 +1951,8 @@ impl AstNode for ParenType { | |||
1946 | } | 1951 | } |
1947 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1952 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1948 | } | 1953 | } |
1949 | impl AstNode for TupleType { | 1954 | impl AstNode for AwaitExpr { |
1950 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE } | 1955 | fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR } |
1951 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1956 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1952 | if Self::can_cast(syntax.kind()) { | 1957 | if Self::can_cast(syntax.kind()) { |
1953 | Some(Self { syntax }) | 1958 | Some(Self { syntax }) |
@@ -1957,8 +1962,8 @@ impl AstNode for TupleType { | |||
1957 | } | 1962 | } |
1958 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1963 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1959 | } | 1964 | } |
1960 | impl AstNode for NeverType { | 1965 | impl AstNode for BinExpr { |
1961 | fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } | 1966 | fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR } |
1962 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1967 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1963 | if Self::can_cast(syntax.kind()) { | 1968 | if Self::can_cast(syntax.kind()) { |
1964 | Some(Self { syntax }) | 1969 | Some(Self { syntax }) |
@@ -1968,8 +1973,8 @@ impl AstNode for NeverType { | |||
1968 | } | 1973 | } |
1969 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1974 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1970 | } | 1975 | } |
1971 | impl AstNode for PathType { | 1976 | impl AstNode for BoxExpr { |
1972 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } | 1977 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR } |
1973 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1978 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1974 | if Self::can_cast(syntax.kind()) { | 1979 | if Self::can_cast(syntax.kind()) { |
1975 | Some(Self { syntax }) | 1980 | Some(Self { syntax }) |
@@ -1979,8 +1984,8 @@ impl AstNode for PathType { | |||
1979 | } | 1984 | } |
1980 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1985 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1981 | } | 1986 | } |
1982 | impl AstNode for PointerType { | 1987 | impl AstNode for BreakExpr { |
1983 | fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE } | 1988 | fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR } |
1984 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1989 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1985 | if Self::can_cast(syntax.kind()) { | 1990 | if Self::can_cast(syntax.kind()) { |
1986 | Some(Self { syntax }) | 1991 | Some(Self { syntax }) |
@@ -1990,8 +1995,8 @@ impl AstNode for PointerType { | |||
1990 | } | 1995 | } |
1991 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1996 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1992 | } | 1997 | } |
1993 | impl AstNode for ArrayType { | 1998 | impl AstNode for CallExpr { |
1994 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE } | 1999 | fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR } |
1995 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2000 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1996 | if Self::can_cast(syntax.kind()) { | 2001 | if Self::can_cast(syntax.kind()) { |
1997 | Some(Self { syntax }) | 2002 | Some(Self { syntax }) |
@@ -2001,8 +2006,8 @@ impl AstNode for ArrayType { | |||
2001 | } | 2006 | } |
2002 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2007 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2003 | } | 2008 | } |
2004 | impl AstNode for SliceType { | 2009 | impl AstNode for CastExpr { |
2005 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE } | 2010 | fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR } |
2006 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2011 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2007 | if Self::can_cast(syntax.kind()) { | 2012 | if Self::can_cast(syntax.kind()) { |
2008 | Some(Self { syntax }) | 2013 | Some(Self { syntax }) |
@@ -2012,8 +2017,8 @@ impl AstNode for SliceType { | |||
2012 | } | 2017 | } |
2013 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2018 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2014 | } | 2019 | } |
2015 | impl AstNode for ReferenceType { | 2020 | impl AstNode for ContinueExpr { |
2016 | fn can_cast(kind: SyntaxKind) -> bool { kind == REFERENCE_TYPE } | 2021 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } |
2017 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2022 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2018 | if Self::can_cast(syntax.kind()) { | 2023 | if Self::can_cast(syntax.kind()) { |
2019 | Some(Self { syntax }) | 2024 | Some(Self { syntax }) |
@@ -2023,8 +2028,8 @@ impl AstNode for ReferenceType { | |||
2023 | } | 2028 | } |
2024 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2029 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2025 | } | 2030 | } |
2026 | impl AstNode for InferType { | 2031 | impl AstNode for EffectExpr { |
2027 | fn can_cast(kind: SyntaxKind) -> bool { kind == INFER_TYPE } | 2032 | fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR } |
2028 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2033 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2029 | if Self::can_cast(syntax.kind()) { | 2034 | if Self::can_cast(syntax.kind()) { |
2030 | Some(Self { syntax }) | 2035 | Some(Self { syntax }) |
@@ -2034,8 +2039,8 @@ impl AstNode for InferType { | |||
2034 | } | 2039 | } |
2035 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2040 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2036 | } | 2041 | } |
2037 | impl AstNode for FnPointerType { | 2042 | impl AstNode for FieldExpr { |
2038 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN_POINTER_TYPE } | 2043 | fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR } |
2039 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2044 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2040 | if Self::can_cast(syntax.kind()) { | 2045 | if Self::can_cast(syntax.kind()) { |
2041 | Some(Self { syntax }) | 2046 | Some(Self { syntax }) |
@@ -2045,8 +2050,8 @@ impl AstNode for FnPointerType { | |||
2045 | } | 2050 | } |
2046 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2051 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2047 | } | 2052 | } |
2048 | impl AstNode for ForType { | 2053 | impl AstNode for ForExpr { |
2049 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE } | 2054 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } |
2050 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2055 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2051 | if Self::can_cast(syntax.kind()) { | 2056 | if Self::can_cast(syntax.kind()) { |
2052 | Some(Self { syntax }) | 2057 | Some(Self { syntax }) |
@@ -2056,8 +2061,8 @@ impl AstNode for ForType { | |||
2056 | } | 2061 | } |
2057 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2062 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2058 | } | 2063 | } |
2059 | impl AstNode for ImplTraitType { | 2064 | impl AstNode for IfExpr { |
2060 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE } | 2065 | fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR } |
2061 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2066 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2062 | if Self::can_cast(syntax.kind()) { | 2067 | if Self::can_cast(syntax.kind()) { |
2063 | Some(Self { syntax }) | 2068 | Some(Self { syntax }) |
@@ -2067,8 +2072,8 @@ impl AstNode for ImplTraitType { | |||
2067 | } | 2072 | } |
2068 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2073 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2069 | } | 2074 | } |
2070 | impl AstNode for DynTraitType { | 2075 | impl AstNode for IndexExpr { |
2071 | fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE } | 2076 | fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR } |
2072 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2077 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2073 | if Self::can_cast(syntax.kind()) { | 2078 | if Self::can_cast(syntax.kind()) { |
2074 | Some(Self { syntax }) | 2079 | Some(Self { syntax }) |
@@ -2078,8 +2083,8 @@ impl AstNode for DynTraitType { | |||
2078 | } | 2083 | } |
2079 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2084 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2080 | } | 2085 | } |
2081 | impl AstNode for TypeBound { | 2086 | impl AstNode for Label { |
2082 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } | 2087 | fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } |
2083 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2088 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2084 | if Self::can_cast(syntax.kind()) { | 2089 | if Self::can_cast(syntax.kind()) { |
2085 | Some(Self { syntax }) | 2090 | Some(Self { syntax }) |
@@ -2089,8 +2094,8 @@ impl AstNode for TypeBound { | |||
2089 | } | 2094 | } |
2090 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2095 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2091 | } | 2096 | } |
2092 | impl AstNode for TupleExpr { | 2097 | impl AstNode for ClosureExpr { |
2093 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR } | 2098 | fn can_cast(kind: SyntaxKind) -> bool { kind == CLOSURE_EXPR } |
2094 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2099 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2095 | if Self::can_cast(syntax.kind()) { | 2100 | if Self::can_cast(syntax.kind()) { |
2096 | Some(Self { syntax }) | 2101 | Some(Self { syntax }) |
@@ -2100,8 +2105,8 @@ impl AstNode for TupleExpr { | |||
2100 | } | 2105 | } |
2101 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2106 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2102 | } | 2107 | } |
2103 | impl AstNode for ArrayExpr { | 2108 | impl AstNode for LoopExpr { |
2104 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_EXPR } | 2109 | fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } |
2105 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2110 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2106 | if Self::can_cast(syntax.kind()) { | 2111 | if Self::can_cast(syntax.kind()) { |
2107 | Some(Self { syntax }) | 2112 | Some(Self { syntax }) |
@@ -2111,8 +2116,8 @@ impl AstNode for ArrayExpr { | |||
2111 | } | 2116 | } |
2112 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2117 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2113 | } | 2118 | } |
2114 | impl AstNode for ParenExpr { | 2119 | impl AstNode for MatchExpr { |
2115 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR } | 2120 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } |
2116 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2121 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2117 | if Self::can_cast(syntax.kind()) { | 2122 | if Self::can_cast(syntax.kind()) { |
2118 | Some(Self { syntax }) | 2123 | Some(Self { syntax }) |
@@ -2122,8 +2127,8 @@ impl AstNode for ParenExpr { | |||
2122 | } | 2127 | } |
2123 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2128 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2124 | } | 2129 | } |
2125 | impl AstNode for PathExpr { | 2130 | impl AstNode for MethodCallExpr { |
2126 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR } | 2131 | fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR } |
2127 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2132 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2128 | if Self::can_cast(syntax.kind()) { | 2133 | if Self::can_cast(syntax.kind()) { |
2129 | Some(Self { syntax }) | 2134 | Some(Self { syntax }) |
@@ -2133,8 +2138,8 @@ impl AstNode for PathExpr { | |||
2133 | } | 2138 | } |
2134 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2139 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2135 | } | 2140 | } |
2136 | impl AstNode for LambdaExpr { | 2141 | impl AstNode for ParenExpr { |
2137 | fn can_cast(kind: SyntaxKind) -> bool { kind == LAMBDA_EXPR } | 2142 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_EXPR } |
2138 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2143 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2139 | if Self::can_cast(syntax.kind()) { | 2144 | if Self::can_cast(syntax.kind()) { |
2140 | Some(Self { syntax }) | 2145 | Some(Self { syntax }) |
@@ -2144,8 +2149,8 @@ impl AstNode for LambdaExpr { | |||
2144 | } | 2149 | } |
2145 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2150 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2146 | } | 2151 | } |
2147 | impl AstNode for IfExpr { | 2152 | impl AstNode for PathExpr { |
2148 | fn can_cast(kind: SyntaxKind) -> bool { kind == IF_EXPR } | 2153 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_EXPR } |
2149 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2154 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2150 | if Self::can_cast(syntax.kind()) { | 2155 | if Self::can_cast(syntax.kind()) { |
2151 | Some(Self { syntax }) | 2156 | Some(Self { syntax }) |
@@ -2155,8 +2160,8 @@ impl AstNode for IfExpr { | |||
2155 | } | 2160 | } |
2156 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2161 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2157 | } | 2162 | } |
2158 | impl AstNode for Condition { | 2163 | impl AstNode for PrefixExpr { |
2159 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION } | 2164 | fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR } |
2160 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2165 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2161 | if Self::can_cast(syntax.kind()) { | 2166 | if Self::can_cast(syntax.kind()) { |
2162 | Some(Self { syntax }) | 2167 | Some(Self { syntax }) |
@@ -2166,8 +2171,8 @@ impl AstNode for Condition { | |||
2166 | } | 2171 | } |
2167 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2172 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2168 | } | 2173 | } |
2169 | impl AstNode for EffectExpr { | 2174 | impl AstNode for RangeExpr { |
2170 | fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR } | 2175 | fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR } |
2171 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2176 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2172 | if Self::can_cast(syntax.kind()) { | 2177 | if Self::can_cast(syntax.kind()) { |
2173 | Some(Self { syntax }) | 2178 | Some(Self { syntax }) |
@@ -2177,8 +2182,8 @@ impl AstNode for EffectExpr { | |||
2177 | } | 2182 | } |
2178 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2183 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2179 | } | 2184 | } |
2180 | impl AstNode for Label { | 2185 | impl AstNode for RecordExpr { |
2181 | fn can_cast(kind: SyntaxKind) -> bool { kind == LABEL } | 2186 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR } |
2182 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2187 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2183 | if Self::can_cast(syntax.kind()) { | 2188 | if Self::can_cast(syntax.kind()) { |
2184 | Some(Self { syntax }) | 2189 | Some(Self { syntax }) |
@@ -2188,8 +2193,8 @@ impl AstNode for Label { | |||
2188 | } | 2193 | } |
2189 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2194 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2190 | } | 2195 | } |
2191 | impl AstNode for LoopExpr { | 2196 | impl AstNode for RefExpr { |
2192 | fn can_cast(kind: SyntaxKind) -> bool { kind == LOOP_EXPR } | 2197 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR } |
2193 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2198 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2194 | if Self::can_cast(syntax.kind()) { | 2199 | if Self::can_cast(syntax.kind()) { |
2195 | Some(Self { syntax }) | 2200 | Some(Self { syntax }) |
@@ -2199,8 +2204,8 @@ impl AstNode for LoopExpr { | |||
2199 | } | 2204 | } |
2200 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2205 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2201 | } | 2206 | } |
2202 | impl AstNode for ForExpr { | 2207 | impl AstNode for ReturnExpr { |
2203 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } | 2208 | fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR } |
2204 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2209 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2205 | if Self::can_cast(syntax.kind()) { | 2210 | if Self::can_cast(syntax.kind()) { |
2206 | Some(Self { syntax }) | 2211 | Some(Self { syntax }) |
@@ -2210,8 +2215,8 @@ impl AstNode for ForExpr { | |||
2210 | } | 2215 | } |
2211 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2216 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2212 | } | 2217 | } |
2213 | impl AstNode for WhileExpr { | 2218 | impl AstNode for TryExpr { |
2214 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR } | 2219 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR } |
2215 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2220 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2216 | if Self::can_cast(syntax.kind()) { | 2221 | if Self::can_cast(syntax.kind()) { |
2217 | Some(Self { syntax }) | 2222 | Some(Self { syntax }) |
@@ -2221,8 +2226,8 @@ impl AstNode for WhileExpr { | |||
2221 | } | 2226 | } |
2222 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2227 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2223 | } | 2228 | } |
2224 | impl AstNode for ContinueExpr { | 2229 | impl AstNode for TupleExpr { |
2225 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONTINUE_EXPR } | 2230 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_EXPR } |
2226 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2231 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2227 | if Self::can_cast(syntax.kind()) { | 2232 | if Self::can_cast(syntax.kind()) { |
2228 | Some(Self { syntax }) | 2233 | Some(Self { syntax }) |
@@ -2232,8 +2237,8 @@ impl AstNode for ContinueExpr { | |||
2232 | } | 2237 | } |
2233 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2238 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2234 | } | 2239 | } |
2235 | impl AstNode for BreakExpr { | 2240 | impl AstNode for WhileExpr { |
2236 | fn can_cast(kind: SyntaxKind) -> bool { kind == BREAK_EXPR } | 2241 | fn can_cast(kind: SyntaxKind) -> bool { kind == WHILE_EXPR } |
2237 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2242 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2238 | if Self::can_cast(syntax.kind()) { | 2243 | if Self::can_cast(syntax.kind()) { |
2239 | Some(Self { syntax }) | 2244 | Some(Self { syntax }) |
@@ -2243,8 +2248,8 @@ impl AstNode for BreakExpr { | |||
2243 | } | 2248 | } |
2244 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2249 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2245 | } | 2250 | } |
2246 | impl AstNode for ReturnExpr { | 2251 | impl AstNode for RecordExprFieldList { |
2247 | fn can_cast(kind: SyntaxKind) -> bool { kind == RETURN_EXPR } | 2252 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST } |
2248 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2253 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2249 | if Self::can_cast(syntax.kind()) { | 2254 | if Self::can_cast(syntax.kind()) { |
2250 | Some(Self { syntax }) | 2255 | Some(Self { syntax }) |
@@ -2254,8 +2259,8 @@ impl AstNode for ReturnExpr { | |||
2254 | } | 2259 | } |
2255 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2260 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2256 | } | 2261 | } |
2257 | impl AstNode for CallExpr { | 2262 | impl AstNode for RecordExprField { |
2258 | fn can_cast(kind: SyntaxKind) -> bool { kind == CALL_EXPR } | 2263 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD } |
2259 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2264 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2260 | if Self::can_cast(syntax.kind()) { | 2265 | if Self::can_cast(syntax.kind()) { |
2261 | Some(Self { syntax }) | 2266 | Some(Self { syntax }) |
@@ -2276,8 +2281,8 @@ impl AstNode for ArgList { | |||
2276 | } | 2281 | } |
2277 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2282 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2278 | } | 2283 | } |
2279 | impl AstNode for MethodCallExpr { | 2284 | impl AstNode for TypeArgList { |
2280 | fn can_cast(kind: SyntaxKind) -> bool { kind == METHOD_CALL_EXPR } | 2285 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST } |
2281 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2286 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2282 | if Self::can_cast(syntax.kind()) { | 2287 | if Self::can_cast(syntax.kind()) { |
2283 | Some(Self { syntax }) | 2288 | Some(Self { syntax }) |
@@ -2287,8 +2292,8 @@ impl AstNode for MethodCallExpr { | |||
2287 | } | 2292 | } |
2288 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2293 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2289 | } | 2294 | } |
2290 | impl AstNode for TypeArgList { | 2295 | impl AstNode for Condition { |
2291 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST } | 2296 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONDITION } |
2292 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2297 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2293 | if Self::can_cast(syntax.kind()) { | 2298 | if Self::can_cast(syntax.kind()) { |
2294 | Some(Self { syntax }) | 2299 | Some(Self { syntax }) |
@@ -2298,8 +2303,8 @@ impl AstNode for TypeArgList { | |||
2298 | } | 2303 | } |
2299 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2304 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2300 | } | 2305 | } |
2301 | impl AstNode for FieldExpr { | 2306 | impl AstNode for MatchArmList { |
2302 | fn can_cast(kind: SyntaxKind) -> bool { kind == FIELD_EXPR } | 2307 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST } |
2303 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2308 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2304 | if Self::can_cast(syntax.kind()) { | 2309 | if Self::can_cast(syntax.kind()) { |
2305 | Some(Self { syntax }) | 2310 | Some(Self { syntax }) |
@@ -2309,8 +2314,8 @@ impl AstNode for FieldExpr { | |||
2309 | } | 2314 | } |
2310 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2315 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2311 | } | 2316 | } |
2312 | impl AstNode for IndexExpr { | 2317 | impl AstNode for MatchArm { |
2313 | fn can_cast(kind: SyntaxKind) -> bool { kind == INDEX_EXPR } | 2318 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM } |
2314 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2319 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2315 | if Self::can_cast(syntax.kind()) { | 2320 | if Self::can_cast(syntax.kind()) { |
2316 | Some(Self { syntax }) | 2321 | Some(Self { syntax }) |
@@ -2320,8 +2325,8 @@ impl AstNode for IndexExpr { | |||
2320 | } | 2325 | } |
2321 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2326 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2322 | } | 2327 | } |
2323 | impl AstNode for AwaitExpr { | 2328 | impl AstNode for MatchGuard { |
2324 | fn can_cast(kind: SyntaxKind) -> bool { kind == AWAIT_EXPR } | 2329 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD } |
2325 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2330 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2326 | if Self::can_cast(syntax.kind()) { | 2331 | if Self::can_cast(syntax.kind()) { |
2327 | Some(Self { syntax }) | 2332 | Some(Self { syntax }) |
@@ -2331,8 +2336,8 @@ impl AstNode for AwaitExpr { | |||
2331 | } | 2336 | } |
2332 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2337 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2333 | } | 2338 | } |
2334 | impl AstNode for TryExpr { | 2339 | impl AstNode for ArrayType { |
2335 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_EXPR } | 2340 | fn can_cast(kind: SyntaxKind) -> bool { kind == ARRAY_TYPE } |
2336 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2341 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2337 | if Self::can_cast(syntax.kind()) { | 2342 | if Self::can_cast(syntax.kind()) { |
2338 | Some(Self { syntax }) | 2343 | Some(Self { syntax }) |
@@ -2342,8 +2347,8 @@ impl AstNode for TryExpr { | |||
2342 | } | 2347 | } |
2343 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2348 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2344 | } | 2349 | } |
2345 | impl AstNode for CastExpr { | 2350 | impl AstNode for DynTraitType { |
2346 | fn can_cast(kind: SyntaxKind) -> bool { kind == CAST_EXPR } | 2351 | fn can_cast(kind: SyntaxKind) -> bool { kind == DYN_TRAIT_TYPE } |
2347 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2352 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2348 | if Self::can_cast(syntax.kind()) { | 2353 | if Self::can_cast(syntax.kind()) { |
2349 | Some(Self { syntax }) | 2354 | Some(Self { syntax }) |
@@ -2353,8 +2358,8 @@ impl AstNode for CastExpr { | |||
2353 | } | 2358 | } |
2354 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2359 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2355 | } | 2360 | } |
2356 | impl AstNode for RefExpr { | 2361 | impl AstNode for FnPointerType { |
2357 | fn can_cast(kind: SyntaxKind) -> bool { kind == REF_EXPR } | 2362 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN_POINTER_TYPE } |
2358 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2363 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2359 | if Self::can_cast(syntax.kind()) { | 2364 | if Self::can_cast(syntax.kind()) { |
2360 | Some(Self { syntax }) | 2365 | Some(Self { syntax }) |
@@ -2364,8 +2369,8 @@ impl AstNode for RefExpr { | |||
2364 | } | 2369 | } |
2365 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2370 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2366 | } | 2371 | } |
2367 | impl AstNode for PrefixExpr { | 2372 | impl AstNode for ForType { |
2368 | fn can_cast(kind: SyntaxKind) -> bool { kind == PREFIX_EXPR } | 2373 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_TYPE } |
2369 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2374 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2370 | if Self::can_cast(syntax.kind()) { | 2375 | if Self::can_cast(syntax.kind()) { |
2371 | Some(Self { syntax }) | 2376 | Some(Self { syntax }) |
@@ -2375,8 +2380,8 @@ impl AstNode for PrefixExpr { | |||
2375 | } | 2380 | } |
2376 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2381 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2377 | } | 2382 | } |
2378 | impl AstNode for BoxExpr { | 2383 | impl AstNode for ImplTraitType { |
2379 | fn can_cast(kind: SyntaxKind) -> bool { kind == BOX_EXPR } | 2384 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_TRAIT_TYPE } |
2380 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2385 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2381 | if Self::can_cast(syntax.kind()) { | 2386 | if Self::can_cast(syntax.kind()) { |
2382 | Some(Self { syntax }) | 2387 | Some(Self { syntax }) |
@@ -2386,8 +2391,8 @@ impl AstNode for BoxExpr { | |||
2386 | } | 2391 | } |
2387 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2392 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2388 | } | 2393 | } |
2389 | impl AstNode for RangeExpr { | 2394 | impl AstNode for InferType { |
2390 | fn can_cast(kind: SyntaxKind) -> bool { kind == RANGE_EXPR } | 2395 | fn can_cast(kind: SyntaxKind) -> bool { kind == INFER_TYPE } |
2391 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2396 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2392 | if Self::can_cast(syntax.kind()) { | 2397 | if Self::can_cast(syntax.kind()) { |
2393 | Some(Self { syntax }) | 2398 | Some(Self { syntax }) |
@@ -2397,8 +2402,8 @@ impl AstNode for RangeExpr { | |||
2397 | } | 2402 | } |
2398 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2403 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2399 | } | 2404 | } |
2400 | impl AstNode for BinExpr { | 2405 | impl AstNode for NeverType { |
2401 | fn can_cast(kind: SyntaxKind) -> bool { kind == BIN_EXPR } | 2406 | fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } |
2402 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2407 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2403 | if Self::can_cast(syntax.kind()) { | 2408 | if Self::can_cast(syntax.kind()) { |
2404 | Some(Self { syntax }) | 2409 | Some(Self { syntax }) |
@@ -2408,8 +2413,8 @@ impl AstNode for BinExpr { | |||
2408 | } | 2413 | } |
2409 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2414 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2410 | } | 2415 | } |
2411 | impl AstNode for MatchExpr { | 2416 | impl AstNode for ParenType { |
2412 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } | 2417 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } |
2413 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2418 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2414 | if Self::can_cast(syntax.kind()) { | 2419 | if Self::can_cast(syntax.kind()) { |
2415 | Some(Self { syntax }) | 2420 | Some(Self { syntax }) |
@@ -2419,8 +2424,8 @@ impl AstNode for MatchExpr { | |||
2419 | } | 2424 | } |
2420 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2425 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2421 | } | 2426 | } |
2422 | impl AstNode for MatchArmList { | 2427 | impl AstNode for PathType { |
2423 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM_LIST } | 2428 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_TYPE } |
2424 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2429 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2425 | if Self::can_cast(syntax.kind()) { | 2430 | if Self::can_cast(syntax.kind()) { |
2426 | Some(Self { syntax }) | 2431 | Some(Self { syntax }) |
@@ -2430,8 +2435,8 @@ impl AstNode for MatchArmList { | |||
2430 | } | 2435 | } |
2431 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2436 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2432 | } | 2437 | } |
2433 | impl AstNode for MatchArm { | 2438 | impl AstNode for PointerType { |
2434 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_ARM } | 2439 | fn can_cast(kind: SyntaxKind) -> bool { kind == POINTER_TYPE } |
2435 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2440 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2436 | if Self::can_cast(syntax.kind()) { | 2441 | if Self::can_cast(syntax.kind()) { |
2437 | Some(Self { syntax }) | 2442 | Some(Self { syntax }) |
@@ -2441,8 +2446,8 @@ impl AstNode for MatchArm { | |||
2441 | } | 2446 | } |
2442 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2447 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2443 | } | 2448 | } |
2444 | impl AstNode for MatchGuard { | 2449 | impl AstNode for ReferenceType { |
2445 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_GUARD } | 2450 | fn can_cast(kind: SyntaxKind) -> bool { kind == REFERENCE_TYPE } |
2446 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2451 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2447 | if Self::can_cast(syntax.kind()) { | 2452 | if Self::can_cast(syntax.kind()) { |
2448 | Some(Self { syntax }) | 2453 | Some(Self { syntax }) |
@@ -2452,8 +2457,8 @@ impl AstNode for MatchGuard { | |||
2452 | } | 2457 | } |
2453 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2458 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2454 | } | 2459 | } |
2455 | impl AstNode for RecordExpr { | 2460 | impl AstNode for SliceType { |
2456 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR } | 2461 | fn can_cast(kind: SyntaxKind) -> bool { kind == SLICE_TYPE } |
2457 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2462 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2458 | if Self::can_cast(syntax.kind()) { | 2463 | if Self::can_cast(syntax.kind()) { |
2459 | Some(Self { syntax }) | 2464 | Some(Self { syntax }) |
@@ -2463,8 +2468,8 @@ impl AstNode for RecordExpr { | |||
2463 | } | 2468 | } |
2464 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2469 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2465 | } | 2470 | } |
2466 | impl AstNode for RecordExprFieldList { | 2471 | impl AstNode for TupleType { |
2467 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST } | 2472 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_TYPE } |
2468 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2473 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2469 | if Self::can_cast(syntax.kind()) { | 2474 | if Self::can_cast(syntax.kind()) { |
2470 | Some(Self { syntax }) | 2475 | Some(Self { syntax }) |
@@ -2474,8 +2479,8 @@ impl AstNode for RecordExprFieldList { | |||
2474 | } | 2479 | } |
2475 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2480 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2476 | } | 2481 | } |
2477 | impl AstNode for RecordExprField { | 2482 | impl AstNode for TypeBound { |
2478 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD } | 2483 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } |
2479 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2484 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2480 | if Self::can_cast(syntax.kind()) { | 2485 | if Self::can_cast(syntax.kind()) { |
2481 | Some(Self { syntax }) | 2486 | Some(Self { syntax }) |
@@ -2849,88 +2854,88 @@ impl AstNode for Item { | |||
2849 | } | 2854 | } |
2850 | } | 2855 | } |
2851 | } | 2856 | } |
2852 | impl From<ParenType> for Type { | 2857 | impl From<ArrayType> for Type { |
2853 | fn from(node: ParenType) -> Type { Type::ParenType(node) } | 2858 | fn from(node: ArrayType) -> Type { Type::ArrayType(node) } |
2854 | } | 2859 | } |
2855 | impl From<TupleType> for Type { | 2860 | impl From<DynTraitType> for Type { |
2856 | fn from(node: TupleType) -> Type { Type::TupleType(node) } | 2861 | fn from(node: DynTraitType) -> Type { Type::DynTraitType(node) } |
2862 | } | ||
2863 | impl From<FnPointerType> for Type { | ||
2864 | fn from(node: FnPointerType) -> Type { Type::FnPointerType(node) } | ||
2865 | } | ||
2866 | impl From<ForType> for Type { | ||
2867 | fn from(node: ForType) -> Type { Type::ForType(node) } | ||
2868 | } | ||
2869 | impl From<ImplTraitType> for Type { | ||
2870 | fn from(node: ImplTraitType) -> Type { Type::ImplTraitType(node) } | ||
2871 | } | ||
2872 | impl From<InferType> for Type { | ||
2873 | fn from(node: InferType) -> Type { Type::InferType(node) } | ||
2857 | } | 2874 | } |
2858 | impl From<NeverType> for Type { | 2875 | impl From<NeverType> for Type { |
2859 | fn from(node: NeverType) -> Type { Type::NeverType(node) } | 2876 | fn from(node: NeverType) -> Type { Type::NeverType(node) } |
2860 | } | 2877 | } |
2878 | impl From<ParenType> for Type { | ||
2879 | fn from(node: ParenType) -> Type { Type::ParenType(node) } | ||
2880 | } | ||
2861 | impl From<PathType> for Type { | 2881 | impl From<PathType> for Type { |
2862 | fn from(node: PathType) -> Type { Type::PathType(node) } | 2882 | fn from(node: PathType) -> Type { Type::PathType(node) } |
2863 | } | 2883 | } |
2864 | impl From<PointerType> for Type { | 2884 | impl From<PointerType> for Type { |
2865 | fn from(node: PointerType) -> Type { Type::PointerType(node) } | 2885 | fn from(node: PointerType) -> Type { Type::PointerType(node) } |
2866 | } | 2886 | } |
2867 | impl From<ArrayType> for Type { | ||
2868 | fn from(node: ArrayType) -> Type { Type::ArrayType(node) } | ||
2869 | } | ||
2870 | impl From<SliceType> for Type { | ||
2871 | fn from(node: SliceType) -> Type { Type::SliceType(node) } | ||
2872 | } | ||
2873 | impl From<ReferenceType> for Type { | 2887 | impl From<ReferenceType> for Type { |
2874 | fn from(node: ReferenceType) -> Type { Type::ReferenceType(node) } | 2888 | fn from(node: ReferenceType) -> Type { Type::ReferenceType(node) } |
2875 | } | 2889 | } |
2876 | impl From<InferType> for Type { | 2890 | impl From<SliceType> for Type { |
2877 | fn from(node: InferType) -> Type { Type::InferType(node) } | 2891 | fn from(node: SliceType) -> Type { Type::SliceType(node) } |
2878 | } | ||
2879 | impl From<FnPointerType> for Type { | ||
2880 | fn from(node: FnPointerType) -> Type { Type::FnPointerType(node) } | ||
2881 | } | ||
2882 | impl From<ForType> for Type { | ||
2883 | fn from(node: ForType) -> Type { Type::ForType(node) } | ||
2884 | } | ||
2885 | impl From<ImplTraitType> for Type { | ||
2886 | fn from(node: ImplTraitType) -> Type { Type::ImplTraitType(node) } | ||
2887 | } | 2892 | } |
2888 | impl From<DynTraitType> for Type { | 2893 | impl From<TupleType> for Type { |
2889 | fn from(node: DynTraitType) -> Type { Type::DynTraitType(node) } | 2894 | fn from(node: TupleType) -> Type { Type::TupleType(node) } |
2890 | } | 2895 | } |
2891 | impl AstNode for Type { | 2896 | impl AstNode for Type { |
2892 | fn can_cast(kind: SyntaxKind) -> bool { | 2897 | fn can_cast(kind: SyntaxKind) -> bool { |
2893 | match kind { | 2898 | match kind { |
2894 | PAREN_TYPE | TUPLE_TYPE | NEVER_TYPE | PATH_TYPE | POINTER_TYPE | ARRAY_TYPE | 2899 | ARRAY_TYPE | DYN_TRAIT_TYPE | FN_POINTER_TYPE | FOR_TYPE | IMPL_TRAIT_TYPE |
2895 | | SLICE_TYPE | REFERENCE_TYPE | INFER_TYPE | FN_POINTER_TYPE | FOR_TYPE | 2900 | | INFER_TYPE | NEVER_TYPE | PAREN_TYPE | PATH_TYPE | POINTER_TYPE | REFERENCE_TYPE |
2896 | | IMPL_TRAIT_TYPE | DYN_TRAIT_TYPE => true, | 2901 | | SLICE_TYPE | TUPLE_TYPE => true, |
2897 | _ => false, | 2902 | _ => false, |
2898 | } | 2903 | } |
2899 | } | 2904 | } |
2900 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2905 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2901 | let res = match syntax.kind() { | 2906 | let res = match syntax.kind() { |
2902 | PAREN_TYPE => Type::ParenType(ParenType { syntax }), | ||
2903 | TUPLE_TYPE => Type::TupleType(TupleType { syntax }), | ||
2904 | NEVER_TYPE => Type::NeverType(NeverType { syntax }), | ||
2905 | PATH_TYPE => Type::PathType(PathType { syntax }), | ||
2906 | POINTER_TYPE => Type::PointerType(PointerType { syntax }), | ||
2907 | ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }), | 2907 | ARRAY_TYPE => Type::ArrayType(ArrayType { syntax }), |
2908 | SLICE_TYPE => Type::SliceType(SliceType { syntax }), | 2908 | DYN_TRAIT_TYPE => Type::DynTraitType(DynTraitType { syntax }), |
2909 | REFERENCE_TYPE => Type::ReferenceType(ReferenceType { syntax }), | ||
2910 | INFER_TYPE => Type::InferType(InferType { syntax }), | ||
2911 | FN_POINTER_TYPE => Type::FnPointerType(FnPointerType { syntax }), | 2909 | FN_POINTER_TYPE => Type::FnPointerType(FnPointerType { syntax }), |
2912 | FOR_TYPE => Type::ForType(ForType { syntax }), | 2910 | FOR_TYPE => Type::ForType(ForType { syntax }), |
2913 | IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), | 2911 | IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), |
2914 | DYN_TRAIT_TYPE => Type::DynTraitType(DynTraitType { syntax }), | 2912 | INFER_TYPE => Type::InferType(InferType { syntax }), |
2913 | NEVER_TYPE => Type::NeverType(NeverType { syntax }), | ||
2914 | PAREN_TYPE => Type::ParenType(ParenType { syntax }), | ||
2915 | PATH_TYPE => Type::PathType(PathType { syntax }), | ||
2916 | POINTER_TYPE => Type::PointerType(PointerType { syntax }), | ||
2917 | REFERENCE_TYPE => Type::ReferenceType(ReferenceType { syntax }), | ||
2918 | SLICE_TYPE => Type::SliceType(SliceType { syntax }), | ||
2919 | TUPLE_TYPE => Type::TupleType(TupleType { syntax }), | ||
2915 | _ => return None, | 2920 | _ => return None, |
2916 | }; | 2921 | }; |
2917 | Some(res) | 2922 | Some(res) |
2918 | } | 2923 | } |
2919 | fn syntax(&self) -> &SyntaxNode { | 2924 | fn syntax(&self) -> &SyntaxNode { |
2920 | match self { | 2925 | match self { |
2921 | Type::ParenType(it) => &it.syntax, | ||
2922 | Type::TupleType(it) => &it.syntax, | ||
2923 | Type::NeverType(it) => &it.syntax, | ||
2924 | Type::PathType(it) => &it.syntax, | ||
2925 | Type::PointerType(it) => &it.syntax, | ||
2926 | Type::ArrayType(it) => &it.syntax, | 2926 | Type::ArrayType(it) => &it.syntax, |
2927 | Type::SliceType(it) => &it.syntax, | 2927 | Type::DynTraitType(it) => &it.syntax, |
2928 | Type::ReferenceType(it) => &it.syntax, | ||
2929 | Type::InferType(it) => &it.syntax, | ||
2930 | Type::FnPointerType(it) => &it.syntax, | 2928 | Type::FnPointerType(it) => &it.syntax, |
2931 | Type::ForType(it) => &it.syntax, | 2929 | Type::ForType(it) => &it.syntax, |
2932 | Type::ImplTraitType(it) => &it.syntax, | 2930 | Type::ImplTraitType(it) => &it.syntax, |
2933 | Type::DynTraitType(it) => &it.syntax, | 2931 | Type::InferType(it) => &it.syntax, |
2932 | Type::NeverType(it) => &it.syntax, | ||
2933 | Type::ParenType(it) => &it.syntax, | ||
2934 | Type::PathType(it) => &it.syntax, | ||
2935 | Type::PointerType(it) => &it.syntax, | ||
2936 | Type::ReferenceType(it) => &it.syntax, | ||
2937 | Type::SliceType(it) => &it.syntax, | ||
2938 | Type::TupleType(it) => &it.syntax, | ||
2934 | } | 2939 | } |
2935 | } | 2940 | } |
2936 | } | 2941 | } |
@@ -3057,80 +3062,74 @@ impl AstNode for FieldList { | |||
3057 | } | 3062 | } |
3058 | } | 3063 | } |
3059 | } | 3064 | } |
3060 | impl From<TupleExpr> for Expr { | ||
3061 | fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) } | ||
3062 | } | ||
3063 | impl From<ArrayExpr> for Expr { | 3065 | impl From<ArrayExpr> for Expr { |
3064 | fn from(node: ArrayExpr) -> Expr { Expr::ArrayExpr(node) } | 3066 | fn from(node: ArrayExpr) -> Expr { Expr::ArrayExpr(node) } |
3065 | } | 3067 | } |
3066 | impl From<ParenExpr> for Expr { | 3068 | impl From<AwaitExpr> for Expr { |
3067 | fn from(node: ParenExpr) -> Expr { Expr::ParenExpr(node) } | 3069 | fn from(node: AwaitExpr) -> Expr { Expr::AwaitExpr(node) } |
3068 | } | 3070 | } |
3069 | impl From<PathExpr> for Expr { | 3071 | impl From<BinExpr> for Expr { |
3070 | fn from(node: PathExpr) -> Expr { Expr::PathExpr(node) } | 3072 | fn from(node: BinExpr) -> Expr { Expr::BinExpr(node) } |
3071 | } | 3073 | } |
3072 | impl From<LambdaExpr> for Expr { | 3074 | impl From<BlockExpr> for Expr { |
3073 | fn from(node: LambdaExpr) -> Expr { Expr::LambdaExpr(node) } | 3075 | fn from(node: BlockExpr) -> Expr { Expr::BlockExpr(node) } |
3074 | } | 3076 | } |
3075 | impl From<IfExpr> for Expr { | 3077 | impl From<BoxExpr> for Expr { |
3076 | fn from(node: IfExpr) -> Expr { Expr::IfExpr(node) } | 3078 | fn from(node: BoxExpr) -> Expr { Expr::BoxExpr(node) } |
3077 | } | 3079 | } |
3078 | impl From<LoopExpr> for Expr { | 3080 | impl From<BreakExpr> for Expr { |
3079 | fn from(node: LoopExpr) -> Expr { Expr::LoopExpr(node) } | 3081 | fn from(node: BreakExpr) -> Expr { Expr::BreakExpr(node) } |
3080 | } | 3082 | } |
3081 | impl From<ForExpr> for Expr { | 3083 | impl From<CallExpr> for Expr { |
3082 | fn from(node: ForExpr) -> Expr { Expr::ForExpr(node) } | 3084 | fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) } |
3083 | } | 3085 | } |
3084 | impl From<WhileExpr> for Expr { | 3086 | impl From<CastExpr> for Expr { |
3085 | fn from(node: WhileExpr) -> Expr { Expr::WhileExpr(node) } | 3087 | fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } |
3086 | } | 3088 | } |
3087 | impl From<ContinueExpr> for Expr { | 3089 | impl From<ContinueExpr> for Expr { |
3088 | fn from(node: ContinueExpr) -> Expr { Expr::ContinueExpr(node) } | 3090 | fn from(node: ContinueExpr) -> Expr { Expr::ContinueExpr(node) } |
3089 | } | 3091 | } |
3090 | impl From<BreakExpr> for Expr { | 3092 | impl From<EffectExpr> for Expr { |
3091 | fn from(node: BreakExpr) -> Expr { Expr::BreakExpr(node) } | 3093 | fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) } |
3092 | } | ||
3093 | impl From<Label> for Expr { | ||
3094 | fn from(node: Label) -> Expr { Expr::Label(node) } | ||
3095 | } | ||
3096 | impl From<BlockExpr> for Expr { | ||
3097 | fn from(node: BlockExpr) -> Expr { Expr::BlockExpr(node) } | ||
3098 | } | ||
3099 | impl From<ReturnExpr> for Expr { | ||
3100 | fn from(node: ReturnExpr) -> Expr { Expr::ReturnExpr(node) } | ||
3101 | } | 3094 | } |
3102 | impl From<MatchExpr> for Expr { | 3095 | impl From<FieldExpr> for Expr { |
3103 | fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) } | 3096 | fn from(node: FieldExpr) -> Expr { Expr::FieldExpr(node) } |
3104 | } | 3097 | } |
3105 | impl From<RecordExpr> for Expr { | 3098 | impl From<ForExpr> for Expr { |
3106 | fn from(node: RecordExpr) -> Expr { Expr::RecordExpr(node) } | 3099 | fn from(node: ForExpr) -> Expr { Expr::ForExpr(node) } |
3107 | } | 3100 | } |
3108 | impl From<CallExpr> for Expr { | 3101 | impl From<IfExpr> for Expr { |
3109 | fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) } | 3102 | fn from(node: IfExpr) -> Expr { Expr::IfExpr(node) } |
3110 | } | 3103 | } |
3111 | impl From<IndexExpr> for Expr { | 3104 | impl From<IndexExpr> for Expr { |
3112 | fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) } | 3105 | fn from(node: IndexExpr) -> Expr { Expr::IndexExpr(node) } |
3113 | } | 3106 | } |
3114 | impl From<MethodCallExpr> for Expr { | 3107 | impl From<Label> for Expr { |
3115 | fn from(node: MethodCallExpr) -> Expr { Expr::MethodCallExpr(node) } | 3108 | fn from(node: Label) -> Expr { Expr::Label(node) } |
3116 | } | 3109 | } |
3117 | impl From<FieldExpr> for Expr { | 3110 | impl From<ClosureExpr> for Expr { |
3118 | fn from(node: FieldExpr) -> Expr { Expr::FieldExpr(node) } | 3111 | fn from(node: ClosureExpr) -> Expr { Expr::ClosureExpr(node) } |
3119 | } | 3112 | } |
3120 | impl From<AwaitExpr> for Expr { | 3113 | impl From<Literal> for Expr { |
3121 | fn from(node: AwaitExpr) -> Expr { Expr::AwaitExpr(node) } | 3114 | fn from(node: Literal) -> Expr { Expr::Literal(node) } |
3122 | } | 3115 | } |
3123 | impl From<TryExpr> for Expr { | 3116 | impl From<LoopExpr> for Expr { |
3124 | fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) } | 3117 | fn from(node: LoopExpr) -> Expr { Expr::LoopExpr(node) } |
3125 | } | 3118 | } |
3126 | impl From<EffectExpr> for Expr { | 3119 | impl From<MacroCall> for Expr { |
3127 | fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) } | 3120 | fn from(node: MacroCall) -> Expr { Expr::MacroCall(node) } |
3128 | } | 3121 | } |
3129 | impl From<CastExpr> for Expr { | 3122 | impl From<MatchExpr> for Expr { |
3130 | fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } | 3123 | fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) } |
3131 | } | 3124 | } |
3132 | impl From<RefExpr> for Expr { | 3125 | impl From<MethodCallExpr> for Expr { |
3133 | fn from(node: RefExpr) -> Expr { Expr::RefExpr(node) } | 3126 | fn from(node: MethodCallExpr) -> Expr { Expr::MethodCallExpr(node) } |
3127 | } | ||
3128 | impl From<ParenExpr> for Expr { | ||
3129 | fn from(node: ParenExpr) -> Expr { Expr::ParenExpr(node) } | ||
3130 | } | ||
3131 | impl From<PathExpr> for Expr { | ||
3132 | fn from(node: PathExpr) -> Expr { Expr::PathExpr(node) } | ||
3134 | } | 3133 | } |
3135 | impl From<PrefixExpr> for Expr { | 3134 | impl From<PrefixExpr> for Expr { |
3136 | fn from(node: PrefixExpr) -> Expr { Expr::PrefixExpr(node) } | 3135 | fn from(node: PrefixExpr) -> Expr { Expr::PrefixExpr(node) } |
@@ -3138,124 +3137,128 @@ impl From<PrefixExpr> for Expr { | |||
3138 | impl From<RangeExpr> for Expr { | 3137 | impl From<RangeExpr> for Expr { |
3139 | fn from(node: RangeExpr) -> Expr { Expr::RangeExpr(node) } | 3138 | fn from(node: RangeExpr) -> Expr { Expr::RangeExpr(node) } |
3140 | } | 3139 | } |
3141 | impl From<BinExpr> for Expr { | 3140 | impl From<RecordExpr> for Expr { |
3142 | fn from(node: BinExpr) -> Expr { Expr::BinExpr(node) } | 3141 | fn from(node: RecordExpr) -> Expr { Expr::RecordExpr(node) } |
3143 | } | 3142 | } |
3144 | impl From<Literal> for Expr { | 3143 | impl From<RefExpr> for Expr { |
3145 | fn from(node: Literal) -> Expr { Expr::Literal(node) } | 3144 | fn from(node: RefExpr) -> Expr { Expr::RefExpr(node) } |
3146 | } | 3145 | } |
3147 | impl From<MacroCall> for Expr { | 3146 | impl From<ReturnExpr> for Expr { |
3148 | fn from(node: MacroCall) -> Expr { Expr::MacroCall(node) } | 3147 | fn from(node: ReturnExpr) -> Expr { Expr::ReturnExpr(node) } |
3149 | } | 3148 | } |
3150 | impl From<BoxExpr> for Expr { | 3149 | impl From<TryExpr> for Expr { |
3151 | fn from(node: BoxExpr) -> Expr { Expr::BoxExpr(node) } | 3150 | fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) } |
3151 | } | ||
3152 | impl From<TupleExpr> for Expr { | ||
3153 | fn from(node: TupleExpr) -> Expr { Expr::TupleExpr(node) } | ||
3154 | } | ||
3155 | impl From<WhileExpr> for Expr { | ||
3156 | fn from(node: WhileExpr) -> Expr { Expr::WhileExpr(node) } | ||
3152 | } | 3157 | } |
3153 | impl AstNode for Expr { | 3158 | impl AstNode for Expr { |
3154 | fn can_cast(kind: SyntaxKind) -> bool { | 3159 | fn can_cast(kind: SyntaxKind) -> bool { |
3155 | match kind { | 3160 | match kind { |
3156 | TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR | 3161 | ARRAY_EXPR | AWAIT_EXPR | BIN_EXPR | BLOCK_EXPR | BOX_EXPR | BREAK_EXPR | CALL_EXPR |
3157 | | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL | 3162 | | CAST_EXPR | CONTINUE_EXPR | EFFECT_EXPR | FIELD_EXPR | FOR_EXPR | IF_EXPR |
3158 | | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_EXPR | CALL_EXPR | INDEX_EXPR | 3163 | | INDEX_EXPR | LABEL | CLOSURE_EXPR | LITERAL | LOOP_EXPR | MACRO_CALL | MATCH_EXPR |
3159 | | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | EFFECT_EXPR | CAST_EXPR | 3164 | | METHOD_CALL_EXPR | PAREN_EXPR | PATH_EXPR | PREFIX_EXPR | RANGE_EXPR |
3160 | | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | BOX_EXPR => { | 3165 | | RECORD_EXPR | REF_EXPR | RETURN_EXPR | TRY_EXPR | TUPLE_EXPR | WHILE_EXPR => true, |
3161 | true | ||
3162 | } | ||
3163 | _ => false, | 3166 | _ => false, |
3164 | } | 3167 | } |
3165 | } | 3168 | } |
3166 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3169 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3167 | let res = match syntax.kind() { | 3170 | let res = match syntax.kind() { |
3168 | TUPLE_EXPR => Expr::TupleExpr(TupleExpr { syntax }), | ||
3169 | ARRAY_EXPR => Expr::ArrayExpr(ArrayExpr { syntax }), | 3171 | ARRAY_EXPR => Expr::ArrayExpr(ArrayExpr { syntax }), |
3170 | PAREN_EXPR => Expr::ParenExpr(ParenExpr { syntax }), | 3172 | AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), |
3171 | PATH_EXPR => Expr::PathExpr(PathExpr { syntax }), | 3173 | BIN_EXPR => Expr::BinExpr(BinExpr { syntax }), |
3172 | LAMBDA_EXPR => Expr::LambdaExpr(LambdaExpr { syntax }), | ||
3173 | IF_EXPR => Expr::IfExpr(IfExpr { syntax }), | ||
3174 | LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }), | ||
3175 | FOR_EXPR => Expr::ForExpr(ForExpr { syntax }), | ||
3176 | WHILE_EXPR => Expr::WhileExpr(WhileExpr { syntax }), | ||
3177 | CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }), | ||
3178 | BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }), | ||
3179 | LABEL => Expr::Label(Label { syntax }), | ||
3180 | BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }), | 3174 | BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }), |
3181 | RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }), | 3175 | BOX_EXPR => Expr::BoxExpr(BoxExpr { syntax }), |
3182 | MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }), | 3176 | BREAK_EXPR => Expr::BreakExpr(BreakExpr { syntax }), |
3183 | RECORD_EXPR => Expr::RecordExpr(RecordExpr { syntax }), | ||
3184 | CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), | 3177 | CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), |
3178 | CAST_EXPR => Expr::CastExpr(CastExpr { syntax }), | ||
3179 | CONTINUE_EXPR => Expr::ContinueExpr(ContinueExpr { syntax }), | ||
3180 | EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }), | ||
3181 | FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), | ||
3182 | FOR_EXPR => Expr::ForExpr(ForExpr { syntax }), | ||
3183 | IF_EXPR => Expr::IfExpr(IfExpr { syntax }), | ||
3185 | INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), | 3184 | INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), |
3185 | LABEL => Expr::Label(Label { syntax }), | ||
3186 | CLOSURE_EXPR => Expr::ClosureExpr(ClosureExpr { syntax }), | ||
3187 | LITERAL => Expr::Literal(Literal { syntax }), | ||
3188 | LOOP_EXPR => Expr::LoopExpr(LoopExpr { syntax }), | ||
3189 | MACRO_CALL => Expr::MacroCall(MacroCall { syntax }), | ||
3190 | MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }), | ||
3186 | METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }), | 3191 | METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }), |
3187 | FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), | 3192 | PAREN_EXPR => Expr::ParenExpr(ParenExpr { syntax }), |
3188 | AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), | 3193 | PATH_EXPR => Expr::PathExpr(PathExpr { syntax }), |
3189 | TRY_EXPR => Expr::TryExpr(TryExpr { syntax }), | ||
3190 | EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }), | ||
3191 | CAST_EXPR => Expr::CastExpr(CastExpr { syntax }), | ||
3192 | REF_EXPR => Expr::RefExpr(RefExpr { syntax }), | ||
3193 | PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }), | 3194 | PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }), |
3194 | RANGE_EXPR => Expr::RangeExpr(RangeExpr { syntax }), | 3195 | RANGE_EXPR => Expr::RangeExpr(RangeExpr { syntax }), |
3195 | BIN_EXPR => Expr::BinExpr(BinExpr { syntax }), | 3196 | RECORD_EXPR => Expr::RecordExpr(RecordExpr { syntax }), |
3196 | LITERAL => Expr::Literal(Literal { syntax }), | 3197 | REF_EXPR => Expr::RefExpr(RefExpr { syntax }), |
3197 | MACRO_CALL => Expr::MacroCall(MacroCall { syntax }), | 3198 | RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }), |
3198 | BOX_EXPR => Expr::BoxExpr(BoxExpr { syntax }), | 3199 | TRY_EXPR => Expr::TryExpr(TryExpr { syntax }), |
3200 | TUPLE_EXPR => Expr::TupleExpr(TupleExpr { syntax }), | ||
3201 | WHILE_EXPR => Expr::WhileExpr(WhileExpr { syntax }), | ||
3199 | _ => return None, | 3202 | _ => return None, |
3200 | }; | 3203 | }; |
3201 | Some(res) | 3204 | Some(res) |
3202 | } | 3205 | } |
3203 | fn syntax(&self) -> &SyntaxNode { | 3206 | fn syntax(&self) -> &SyntaxNode { |
3204 | match self { | 3207 | match self { |
3205 | Expr::TupleExpr(it) => &it.syntax, | ||
3206 | Expr::ArrayExpr(it) => &it.syntax, | 3208 | Expr::ArrayExpr(it) => &it.syntax, |
3207 | Expr::ParenExpr(it) => &it.syntax, | 3209 | Expr::AwaitExpr(it) => &it.syntax, |
3208 | Expr::PathExpr(it) => &it.syntax, | 3210 | Expr::BinExpr(it) => &it.syntax, |
3209 | Expr::LambdaExpr(it) => &it.syntax, | ||
3210 | Expr::IfExpr(it) => &it.syntax, | ||
3211 | Expr::LoopExpr(it) => &it.syntax, | ||
3212 | Expr::ForExpr(it) => &it.syntax, | ||
3213 | Expr::WhileExpr(it) => &it.syntax, | ||
3214 | Expr::ContinueExpr(it) => &it.syntax, | ||
3215 | Expr::BreakExpr(it) => &it.syntax, | ||
3216 | Expr::Label(it) => &it.syntax, | ||
3217 | Expr::BlockExpr(it) => &it.syntax, | 3211 | Expr::BlockExpr(it) => &it.syntax, |
3218 | Expr::ReturnExpr(it) => &it.syntax, | 3212 | Expr::BoxExpr(it) => &it.syntax, |
3219 | Expr::MatchExpr(it) => &it.syntax, | 3213 | Expr::BreakExpr(it) => &it.syntax, |
3220 | Expr::RecordExpr(it) => &it.syntax, | ||
3221 | Expr::CallExpr(it) => &it.syntax, | 3214 | Expr::CallExpr(it) => &it.syntax, |
3215 | Expr::CastExpr(it) => &it.syntax, | ||
3216 | Expr::ContinueExpr(it) => &it.syntax, | ||
3217 | Expr::EffectExpr(it) => &it.syntax, | ||
3218 | Expr::FieldExpr(it) => &it.syntax, | ||
3219 | Expr::ForExpr(it) => &it.syntax, | ||
3220 | Expr::IfExpr(it) => &it.syntax, | ||
3222 | Expr::IndexExpr(it) => &it.syntax, | 3221 | Expr::IndexExpr(it) => &it.syntax, |
3222 | Expr::Label(it) => &it.syntax, | ||
3223 | Expr::ClosureExpr(it) => &it.syntax, | ||
3224 | Expr::Literal(it) => &it.syntax, | ||
3225 | Expr::LoopExpr(it) => &it.syntax, | ||
3226 | Expr::MacroCall(it) => &it.syntax, | ||
3227 | Expr::MatchExpr(it) => &it.syntax, | ||
3223 | Expr::MethodCallExpr(it) => &it.syntax, | 3228 | Expr::MethodCallExpr(it) => &it.syntax, |
3224 | Expr::FieldExpr(it) => &it.syntax, | 3229 | Expr::ParenExpr(it) => &it.syntax, |
3225 | Expr::AwaitExpr(it) => &it.syntax, | 3230 | Expr::PathExpr(it) => &it.syntax, |
3226 | Expr::TryExpr(it) => &it.syntax, | ||
3227 | Expr::EffectExpr(it) => &it.syntax, | ||
3228 | Expr::CastExpr(it) => &it.syntax, | ||
3229 | Expr::RefExpr(it) => &it.syntax, | ||
3230 | Expr::PrefixExpr(it) => &it.syntax, | 3231 | Expr::PrefixExpr(it) => &it.syntax, |
3231 | Expr::RangeExpr(it) => &it.syntax, | 3232 | Expr::RangeExpr(it) => &it.syntax, |
3232 | Expr::BinExpr(it) => &it.syntax, | 3233 | Expr::RecordExpr(it) => &it.syntax, |
3233 | Expr::Literal(it) => &it.syntax, | 3234 | Expr::RefExpr(it) => &it.syntax, |
3234 | Expr::MacroCall(it) => &it.syntax, | 3235 | Expr::ReturnExpr(it) => &it.syntax, |
3235 | Expr::BoxExpr(it) => &it.syntax, | 3236 | Expr::TryExpr(it) => &it.syntax, |
3237 | Expr::TupleExpr(it) => &it.syntax, | ||
3238 | Expr::WhileExpr(it) => &it.syntax, | ||
3236 | } | 3239 | } |
3237 | } | 3240 | } |
3238 | } | 3241 | } |
3239 | impl From<Struct> for AdtDef { | ||
3240 | fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) } | ||
3241 | } | ||
3242 | impl From<Enum> for AdtDef { | 3242 | impl From<Enum> for AdtDef { |
3243 | fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) } | 3243 | fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) } |
3244 | } | 3244 | } |
3245 | impl From<Struct> for AdtDef { | ||
3246 | fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) } | ||
3247 | } | ||
3245 | impl From<Union> for AdtDef { | 3248 | impl From<Union> for AdtDef { |
3246 | fn from(node: Union) -> AdtDef { AdtDef::Union(node) } | 3249 | fn from(node: Union) -> AdtDef { AdtDef::Union(node) } |
3247 | } | 3250 | } |
3248 | impl AstNode for AdtDef { | 3251 | impl AstNode for AdtDef { |
3249 | fn can_cast(kind: SyntaxKind) -> bool { | 3252 | fn can_cast(kind: SyntaxKind) -> bool { |
3250 | match kind { | 3253 | match kind { |
3251 | STRUCT | ENUM | UNION => true, | 3254 | ENUM | STRUCT | UNION => true, |
3252 | _ => false, | 3255 | _ => false, |
3253 | } | 3256 | } |
3254 | } | 3257 | } |
3255 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3258 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3256 | let res = match syntax.kind() { | 3259 | let res = match syntax.kind() { |
3257 | STRUCT => AdtDef::Struct(Struct { syntax }), | ||
3258 | ENUM => AdtDef::Enum(Enum { syntax }), | 3260 | ENUM => AdtDef::Enum(Enum { syntax }), |
3261 | STRUCT => AdtDef::Struct(Struct { syntax }), | ||
3259 | UNION => AdtDef::Union(Union { syntax }), | 3262 | UNION => AdtDef::Union(Union { syntax }), |
3260 | _ => return None, | 3263 | _ => return None, |
3261 | }; | 3264 | }; |
@@ -3263,47 +3266,47 @@ impl AstNode for AdtDef { | |||
3263 | } | 3266 | } |
3264 | fn syntax(&self) -> &SyntaxNode { | 3267 | fn syntax(&self) -> &SyntaxNode { |
3265 | match self { | 3268 | match self { |
3266 | AdtDef::Struct(it) => &it.syntax, | ||
3267 | AdtDef::Enum(it) => &it.syntax, | 3269 | AdtDef::Enum(it) => &it.syntax, |
3270 | AdtDef::Struct(it) => &it.syntax, | ||
3268 | AdtDef::Union(it) => &it.syntax, | 3271 | AdtDef::Union(it) => &it.syntax, |
3269 | } | 3272 | } |
3270 | } | 3273 | } |
3271 | } | 3274 | } |
3272 | impl From<Fn> for AssocItem { | ||
3273 | fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) } | ||
3274 | } | ||
3275 | impl From<TypeAlias> for AssocItem { | ||
3276 | fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) } | ||
3277 | } | ||
3278 | impl From<Const> for AssocItem { | 3275 | impl From<Const> for AssocItem { |
3279 | fn from(node: Const) -> AssocItem { AssocItem::Const(node) } | 3276 | fn from(node: Const) -> AssocItem { AssocItem::Const(node) } |
3280 | } | 3277 | } |
3278 | impl From<Fn> for AssocItem { | ||
3279 | fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) } | ||
3280 | } | ||
3281 | impl From<MacroCall> for AssocItem { | 3281 | impl From<MacroCall> for AssocItem { |
3282 | fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) } | 3282 | fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) } |
3283 | } | 3283 | } |
3284 | impl From<TypeAlias> for AssocItem { | ||
3285 | fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) } | ||
3286 | } | ||
3284 | impl AstNode for AssocItem { | 3287 | impl AstNode for AssocItem { |
3285 | fn can_cast(kind: SyntaxKind) -> bool { | 3288 | fn can_cast(kind: SyntaxKind) -> bool { |
3286 | match kind { | 3289 | match kind { |
3287 | FN | TYPE_ALIAS | CONST | MACRO_CALL => true, | 3290 | CONST | FN | MACRO_CALL | TYPE_ALIAS => true, |
3288 | _ => false, | 3291 | _ => false, |
3289 | } | 3292 | } |
3290 | } | 3293 | } |
3291 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3294 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3292 | let res = match syntax.kind() { | 3295 | let res = match syntax.kind() { |
3293 | FN => AssocItem::Fn(Fn { syntax }), | ||
3294 | TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }), | ||
3295 | CONST => AssocItem::Const(Const { syntax }), | 3296 | CONST => AssocItem::Const(Const { syntax }), |
3297 | FN => AssocItem::Fn(Fn { syntax }), | ||
3296 | MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }), | 3298 | MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }), |
3299 | TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }), | ||
3297 | _ => return None, | 3300 | _ => return None, |
3298 | }; | 3301 | }; |
3299 | Some(res) | 3302 | Some(res) |
3300 | } | 3303 | } |
3301 | fn syntax(&self) -> &SyntaxNode { | 3304 | fn syntax(&self) -> &SyntaxNode { |
3302 | match self { | 3305 | match self { |
3303 | AssocItem::Fn(it) => &it.syntax, | ||
3304 | AssocItem::TypeAlias(it) => &it.syntax, | ||
3305 | AssocItem::Const(it) => &it.syntax, | 3306 | AssocItem::Const(it) => &it.syntax, |
3307 | AssocItem::Fn(it) => &it.syntax, | ||
3306 | AssocItem::MacroCall(it) => &it.syntax, | 3308 | AssocItem::MacroCall(it) => &it.syntax, |
3309 | AssocItem::TypeAlias(it) => &it.syntax, | ||
3307 | } | 3310 | } |
3308 | } | 3311 | } |
3309 | } | 3312 | } |
@@ -3340,48 +3343,48 @@ impl AstNode for ExternItem { | |||
3340 | } | 3343 | } |
3341 | } | 3344 | } |
3342 | } | 3345 | } |
3346 | impl From<ConstParam> for GenericParam { | ||
3347 | fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) } | ||
3348 | } | ||
3343 | impl From<LifetimeParam> for GenericParam { | 3349 | impl From<LifetimeParam> for GenericParam { |
3344 | fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) } | 3350 | fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) } |
3345 | } | 3351 | } |
3346 | impl From<TypeParam> for GenericParam { | 3352 | impl From<TypeParam> for GenericParam { |
3347 | fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) } | 3353 | fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) } |
3348 | } | 3354 | } |
3349 | impl From<ConstParam> for GenericParam { | ||
3350 | fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) } | ||
3351 | } | ||
3352 | impl AstNode for GenericParam { | 3355 | impl AstNode for GenericParam { |
3353 | fn can_cast(kind: SyntaxKind) -> bool { | 3356 | fn can_cast(kind: SyntaxKind) -> bool { |
3354 | match kind { | 3357 | match kind { |
3355 | LIFETIME_PARAM | TYPE_PARAM | CONST_PARAM => true, | 3358 | CONST_PARAM | LIFETIME_PARAM | TYPE_PARAM => true, |
3356 | _ => false, | 3359 | _ => false, |
3357 | } | 3360 | } |
3358 | } | 3361 | } |
3359 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3362 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3360 | let res = match syntax.kind() { | 3363 | let res = match syntax.kind() { |
3364 | CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }), | ||
3361 | LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }), | 3365 | LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }), |
3362 | TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }), | 3366 | TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }), |
3363 | CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }), | ||
3364 | _ => return None, | 3367 | _ => return None, |
3365 | }; | 3368 | }; |
3366 | Some(res) | 3369 | Some(res) |
3367 | } | 3370 | } |
3368 | fn syntax(&self) -> &SyntaxNode { | 3371 | fn syntax(&self) -> &SyntaxNode { |
3369 | match self { | 3372 | match self { |
3373 | GenericParam::ConstParam(it) => &it.syntax, | ||
3370 | GenericParam::LifetimeParam(it) => &it.syntax, | 3374 | GenericParam::LifetimeParam(it) => &it.syntax, |
3371 | GenericParam::TypeParam(it) => &it.syntax, | 3375 | GenericParam::TypeParam(it) => &it.syntax, |
3372 | GenericParam::ConstParam(it) => &it.syntax, | ||
3373 | } | 3376 | } |
3374 | } | 3377 | } |
3375 | } | 3378 | } |
3376 | impl From<LetStmt> for Stmt { | ||
3377 | fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } | ||
3378 | } | ||
3379 | impl From<ExprStmt> for Stmt { | 3379 | impl From<ExprStmt> for Stmt { |
3380 | fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } | 3380 | fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } |
3381 | } | 3381 | } |
3382 | impl From<Item> for Stmt { | 3382 | impl From<Item> for Stmt { |
3383 | fn from(node: Item) -> Stmt { Stmt::Item(node) } | 3383 | fn from(node: Item) -> Stmt { Stmt::Item(node) } |
3384 | } | 3384 | } |
3385 | impl From<LetStmt> for Stmt { | ||
3386 | fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } | ||
3387 | } | ||
3385 | impl std::fmt::Display for Item { | 3388 | impl std::fmt::Display for Item { |
3386 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3389 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3387 | std::fmt::Display::fmt(self.syntax(), f) | 3390 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3637,17 +3640,17 @@ impl std::fmt::Display for ExternItemList { | |||
3637 | std::fmt::Display::fmt(self.syntax(), f) | 3640 | std::fmt::Display::fmt(self.syntax(), f) |
3638 | } | 3641 | } |
3639 | } | 3642 | } |
3640 | impl std::fmt::Display for LifetimeParam { | 3643 | impl std::fmt::Display for ConstParam { |
3641 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3644 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3642 | std::fmt::Display::fmt(self.syntax(), f) | 3645 | std::fmt::Display::fmt(self.syntax(), f) |
3643 | } | 3646 | } |
3644 | } | 3647 | } |
3645 | impl std::fmt::Display for TypeParam { | 3648 | impl std::fmt::Display for LifetimeParam { |
3646 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3649 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3647 | std::fmt::Display::fmt(self.syntax(), f) | 3650 | std::fmt::Display::fmt(self.syntax(), f) |
3648 | } | 3651 | } |
3649 | } | 3652 | } |
3650 | impl std::fmt::Display for ConstParam { | 3653 | impl std::fmt::Display for TypeParam { |
3651 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3654 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3652 | std::fmt::Display::fmt(self.syntax(), f) | 3655 | std::fmt::Display::fmt(self.syntax(), f) |
3653 | } | 3656 | } |
@@ -3667,162 +3670,162 @@ impl std::fmt::Display for TokenTree { | |||
3667 | std::fmt::Display::fmt(self.syntax(), f) | 3670 | std::fmt::Display::fmt(self.syntax(), f) |
3668 | } | 3671 | } |
3669 | } | 3672 | } |
3670 | impl std::fmt::Display for LetStmt { | 3673 | impl std::fmt::Display for ExprStmt { |
3671 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3674 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3672 | std::fmt::Display::fmt(self.syntax(), f) | 3675 | std::fmt::Display::fmt(self.syntax(), f) |
3673 | } | 3676 | } |
3674 | } | 3677 | } |
3675 | impl std::fmt::Display for ExprStmt { | 3678 | impl std::fmt::Display for LetStmt { |
3676 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3679 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3677 | std::fmt::Display::fmt(self.syntax(), f) | 3680 | std::fmt::Display::fmt(self.syntax(), f) |
3678 | } | 3681 | } |
3679 | } | 3682 | } |
3680 | impl std::fmt::Display for ParenType { | 3683 | impl std::fmt::Display for ArrayExpr { |
3681 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3684 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3682 | std::fmt::Display::fmt(self.syntax(), f) | 3685 | std::fmt::Display::fmt(self.syntax(), f) |
3683 | } | 3686 | } |
3684 | } | 3687 | } |
3685 | impl std::fmt::Display for TupleType { | 3688 | impl std::fmt::Display for AwaitExpr { |
3686 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3689 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3687 | std::fmt::Display::fmt(self.syntax(), f) | 3690 | std::fmt::Display::fmt(self.syntax(), f) |
3688 | } | 3691 | } |
3689 | } | 3692 | } |
3690 | impl std::fmt::Display for NeverType { | 3693 | impl std::fmt::Display for BinExpr { |
3691 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3694 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3692 | std::fmt::Display::fmt(self.syntax(), f) | 3695 | std::fmt::Display::fmt(self.syntax(), f) |
3693 | } | 3696 | } |
3694 | } | 3697 | } |
3695 | impl std::fmt::Display for PathType { | 3698 | impl std::fmt::Display for BoxExpr { |
3696 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3699 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3697 | std::fmt::Display::fmt(self.syntax(), f) | 3700 | std::fmt::Display::fmt(self.syntax(), f) |
3698 | } | 3701 | } |
3699 | } | 3702 | } |
3700 | impl std::fmt::Display for PointerType { | 3703 | impl std::fmt::Display for BreakExpr { |
3701 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3704 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3702 | std::fmt::Display::fmt(self.syntax(), f) | 3705 | std::fmt::Display::fmt(self.syntax(), f) |
3703 | } | 3706 | } |
3704 | } | 3707 | } |
3705 | impl std::fmt::Display for ArrayType { | 3708 | impl std::fmt::Display for CallExpr { |
3706 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3709 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3707 | std::fmt::Display::fmt(self.syntax(), f) | 3710 | std::fmt::Display::fmt(self.syntax(), f) |
3708 | } | 3711 | } |
3709 | } | 3712 | } |
3710 | impl std::fmt::Display for SliceType { | 3713 | impl std::fmt::Display for CastExpr { |
3711 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3714 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3712 | std::fmt::Display::fmt(self.syntax(), f) | 3715 | std::fmt::Display::fmt(self.syntax(), f) |
3713 | } | 3716 | } |
3714 | } | 3717 | } |
3715 | impl std::fmt::Display for ReferenceType { | 3718 | impl std::fmt::Display for ContinueExpr { |
3716 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3719 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3717 | std::fmt::Display::fmt(self.syntax(), f) | 3720 | std::fmt::Display::fmt(self.syntax(), f) |
3718 | } | 3721 | } |
3719 | } | 3722 | } |
3720 | impl std::fmt::Display for InferType { | 3723 | impl std::fmt::Display for EffectExpr { |
3721 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3724 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3722 | std::fmt::Display::fmt(self.syntax(), f) | 3725 | std::fmt::Display::fmt(self.syntax(), f) |
3723 | } | 3726 | } |
3724 | } | 3727 | } |
3725 | impl std::fmt::Display for FnPointerType { | 3728 | impl std::fmt::Display for FieldExpr { |
3726 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3729 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3727 | std::fmt::Display::fmt(self.syntax(), f) | 3730 | std::fmt::Display::fmt(self.syntax(), f) |
3728 | } | 3731 | } |
3729 | } | 3732 | } |
3730 | impl std::fmt::Display for ForType { | 3733 | impl std::fmt::Display for ForExpr { |
3731 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3734 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3732 | std::fmt::Display::fmt(self.syntax(), f) | 3735 | std::fmt::Display::fmt(self.syntax(), f) |
3733 | } | 3736 | } |
3734 | } | 3737 | } |
3735 | impl std::fmt::Display for ImplTraitType { | 3738 | impl std::fmt::Display for IfExpr { |
3736 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3739 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3737 | std::fmt::Display::fmt(self.syntax(), f) | 3740 | std::fmt::Display::fmt(self.syntax(), f) |
3738 | } | 3741 | } |
3739 | } | 3742 | } |
3740 | impl std::fmt::Display for DynTraitType { | 3743 | impl std::fmt::Display for IndexExpr { |
3741 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3744 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3742 | std::fmt::Display::fmt(self.syntax(), f) | 3745 | std::fmt::Display::fmt(self.syntax(), f) |
3743 | } | 3746 | } |
3744 | } | 3747 | } |
3745 | impl std::fmt::Display for TypeBound { | 3748 | impl std::fmt::Display for Label { |
3746 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3749 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3747 | std::fmt::Display::fmt(self.syntax(), f) | 3750 | std::fmt::Display::fmt(self.syntax(), f) |
3748 | } | 3751 | } |
3749 | } | 3752 | } |
3750 | impl std::fmt::Display for TupleExpr { | 3753 | impl std::fmt::Display for ClosureExpr { |
3751 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3754 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3752 | std::fmt::Display::fmt(self.syntax(), f) | 3755 | std::fmt::Display::fmt(self.syntax(), f) |
3753 | } | 3756 | } |
3754 | } | 3757 | } |
3755 | impl std::fmt::Display for ArrayExpr { | 3758 | impl std::fmt::Display for LoopExpr { |
3756 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3759 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3757 | std::fmt::Display::fmt(self.syntax(), f) | 3760 | std::fmt::Display::fmt(self.syntax(), f) |
3758 | } | 3761 | } |
3759 | } | 3762 | } |
3760 | impl std::fmt::Display for ParenExpr { | 3763 | impl std::fmt::Display for MatchExpr { |
3761 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3764 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3762 | std::fmt::Display::fmt(self.syntax(), f) | 3765 | std::fmt::Display::fmt(self.syntax(), f) |
3763 | } | 3766 | } |
3764 | } | 3767 | } |
3765 | impl std::fmt::Display for PathExpr { | 3768 | impl std::fmt::Display for MethodCallExpr { |
3766 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3769 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3767 | std::fmt::Display::fmt(self.syntax(), f) | 3770 | std::fmt::Display::fmt(self.syntax(), f) |
3768 | } | 3771 | } |
3769 | } | 3772 | } |
3770 | impl std::fmt::Display for LambdaExpr { | 3773 | impl std::fmt::Display for ParenExpr { |
3771 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3774 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3772 | std::fmt::Display::fmt(self.syntax(), f) | 3775 | std::fmt::Display::fmt(self.syntax(), f) |
3773 | } | 3776 | } |
3774 | } | 3777 | } |
3775 | impl std::fmt::Display for IfExpr { | 3778 | impl std::fmt::Display for PathExpr { |
3776 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3779 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3777 | std::fmt::Display::fmt(self.syntax(), f) | 3780 | std::fmt::Display::fmt(self.syntax(), f) |
3778 | } | 3781 | } |
3779 | } | 3782 | } |
3780 | impl std::fmt::Display for Condition { | 3783 | impl std::fmt::Display for PrefixExpr { |
3781 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3784 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3782 | std::fmt::Display::fmt(self.syntax(), f) | 3785 | std::fmt::Display::fmt(self.syntax(), f) |
3783 | } | 3786 | } |
3784 | } | 3787 | } |
3785 | impl std::fmt::Display for EffectExpr { | 3788 | impl std::fmt::Display for RangeExpr { |
3786 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3789 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3787 | std::fmt::Display::fmt(self.syntax(), f) | 3790 | std::fmt::Display::fmt(self.syntax(), f) |
3788 | } | 3791 | } |
3789 | } | 3792 | } |
3790 | impl std::fmt::Display for Label { | 3793 | impl std::fmt::Display for RecordExpr { |
3791 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3794 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3792 | std::fmt::Display::fmt(self.syntax(), f) | 3795 | std::fmt::Display::fmt(self.syntax(), f) |
3793 | } | 3796 | } |
3794 | } | 3797 | } |
3795 | impl std::fmt::Display for LoopExpr { | 3798 | impl std::fmt::Display for RefExpr { |
3796 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3799 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3797 | std::fmt::Display::fmt(self.syntax(), f) | 3800 | std::fmt::Display::fmt(self.syntax(), f) |
3798 | } | 3801 | } |
3799 | } | 3802 | } |
3800 | impl std::fmt::Display for ForExpr { | 3803 | impl std::fmt::Display for ReturnExpr { |
3801 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3804 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3802 | std::fmt::Display::fmt(self.syntax(), f) | 3805 | std::fmt::Display::fmt(self.syntax(), f) |
3803 | } | 3806 | } |
3804 | } | 3807 | } |
3805 | impl std::fmt::Display for WhileExpr { | 3808 | impl std::fmt::Display for TryExpr { |
3806 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3809 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3807 | std::fmt::Display::fmt(self.syntax(), f) | 3810 | std::fmt::Display::fmt(self.syntax(), f) |
3808 | } | 3811 | } |
3809 | } | 3812 | } |
3810 | impl std::fmt::Display for ContinueExpr { | 3813 | impl std::fmt::Display for TupleExpr { |
3811 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3814 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3812 | std::fmt::Display::fmt(self.syntax(), f) | 3815 | std::fmt::Display::fmt(self.syntax(), f) |
3813 | } | 3816 | } |
3814 | } | 3817 | } |
3815 | impl std::fmt::Display for BreakExpr { | 3818 | impl std::fmt::Display for WhileExpr { |
3816 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3819 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3817 | std::fmt::Display::fmt(self.syntax(), f) | 3820 | std::fmt::Display::fmt(self.syntax(), f) |
3818 | } | 3821 | } |
3819 | } | 3822 | } |
3820 | impl std::fmt::Display for ReturnExpr { | 3823 | impl std::fmt::Display for RecordExprFieldList { |
3821 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3824 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3822 | std::fmt::Display::fmt(self.syntax(), f) | 3825 | std::fmt::Display::fmt(self.syntax(), f) |
3823 | } | 3826 | } |
3824 | } | 3827 | } |
3825 | impl std::fmt::Display for CallExpr { | 3828 | impl std::fmt::Display for RecordExprField { |
3826 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3829 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3827 | std::fmt::Display::fmt(self.syntax(), f) | 3830 | std::fmt::Display::fmt(self.syntax(), f) |
3828 | } | 3831 | } |
@@ -3832,97 +3835,97 @@ impl std::fmt::Display for ArgList { | |||
3832 | std::fmt::Display::fmt(self.syntax(), f) | 3835 | std::fmt::Display::fmt(self.syntax(), f) |
3833 | } | 3836 | } |
3834 | } | 3837 | } |
3835 | impl std::fmt::Display for MethodCallExpr { | 3838 | impl std::fmt::Display for TypeArgList { |
3836 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3839 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3837 | std::fmt::Display::fmt(self.syntax(), f) | 3840 | std::fmt::Display::fmt(self.syntax(), f) |
3838 | } | 3841 | } |
3839 | } | 3842 | } |
3840 | impl std::fmt::Display for TypeArgList { | 3843 | impl std::fmt::Display for Condition { |
3841 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3844 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3842 | std::fmt::Display::fmt(self.syntax(), f) | 3845 | std::fmt::Display::fmt(self.syntax(), f) |
3843 | } | 3846 | } |
3844 | } | 3847 | } |
3845 | impl std::fmt::Display for FieldExpr { | 3848 | impl std::fmt::Display for MatchArmList { |
3846 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3849 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3847 | std::fmt::Display::fmt(self.syntax(), f) | 3850 | std::fmt::Display::fmt(self.syntax(), f) |
3848 | } | 3851 | } |
3849 | } | 3852 | } |
3850 | impl std::fmt::Display for IndexExpr { | 3853 | impl std::fmt::Display for MatchArm { |
3851 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3854 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3852 | std::fmt::Display::fmt(self.syntax(), f) | 3855 | std::fmt::Display::fmt(self.syntax(), f) |
3853 | } | 3856 | } |
3854 | } | 3857 | } |
3855 | impl std::fmt::Display for AwaitExpr { | 3858 | impl std::fmt::Display for MatchGuard { |
3856 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3859 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3857 | std::fmt::Display::fmt(self.syntax(), f) | 3860 | std::fmt::Display::fmt(self.syntax(), f) |
3858 | } | 3861 | } |
3859 | } | 3862 | } |
3860 | impl std::fmt::Display for TryExpr { | 3863 | impl std::fmt::Display for ArrayType { |
3861 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3864 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3862 | std::fmt::Display::fmt(self.syntax(), f) | 3865 | std::fmt::Display::fmt(self.syntax(), f) |
3863 | } | 3866 | } |
3864 | } | 3867 | } |
3865 | impl std::fmt::Display for CastExpr { | 3868 | impl std::fmt::Display for DynTraitType { |
3866 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3869 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3867 | std::fmt::Display::fmt(self.syntax(), f) | 3870 | std::fmt::Display::fmt(self.syntax(), f) |
3868 | } | 3871 | } |
3869 | } | 3872 | } |
3870 | impl std::fmt::Display for RefExpr { | 3873 | impl std::fmt::Display for FnPointerType { |
3871 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3874 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3872 | std::fmt::Display::fmt(self.syntax(), f) | 3875 | std::fmt::Display::fmt(self.syntax(), f) |
3873 | } | 3876 | } |
3874 | } | 3877 | } |
3875 | impl std::fmt::Display for PrefixExpr { | 3878 | impl std::fmt::Display for ForType { |
3876 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3879 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3877 | std::fmt::Display::fmt(self.syntax(), f) | 3880 | std::fmt::Display::fmt(self.syntax(), f) |
3878 | } | 3881 | } |
3879 | } | 3882 | } |
3880 | impl std::fmt::Display for BoxExpr { | 3883 | impl std::fmt::Display for ImplTraitType { |
3881 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3884 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3882 | std::fmt::Display::fmt(self.syntax(), f) | 3885 | std::fmt::Display::fmt(self.syntax(), f) |
3883 | } | 3886 | } |
3884 | } | 3887 | } |
3885 | impl std::fmt::Display for RangeExpr { | 3888 | impl std::fmt::Display for InferType { |
3886 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3889 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3887 | std::fmt::Display::fmt(self.syntax(), f) | 3890 | std::fmt::Display::fmt(self.syntax(), f) |
3888 | } | 3891 | } |
3889 | } | 3892 | } |
3890 | impl std::fmt::Display for BinExpr { | 3893 | impl std::fmt::Display for NeverType { |
3891 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3894 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3892 | std::fmt::Display::fmt(self.syntax(), f) | 3895 | std::fmt::Display::fmt(self.syntax(), f) |
3893 | } | 3896 | } |
3894 | } | 3897 | } |
3895 | impl std::fmt::Display for MatchExpr { | 3898 | impl std::fmt::Display for ParenType { |
3896 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3899 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3897 | std::fmt::Display::fmt(self.syntax(), f) | 3900 | std::fmt::Display::fmt(self.syntax(), f) |
3898 | } | 3901 | } |
3899 | } | 3902 | } |
3900 | impl std::fmt::Display for MatchArmList { | 3903 | impl std::fmt::Display for PathType { |
3901 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3904 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3902 | std::fmt::Display::fmt(self.syntax(), f) | 3905 | std::fmt::Display::fmt(self.syntax(), f) |
3903 | } | 3906 | } |
3904 | } | 3907 | } |
3905 | impl std::fmt::Display for MatchArm { | 3908 | impl std::fmt::Display for PointerType { |
3906 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3909 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3907 | std::fmt::Display::fmt(self.syntax(), f) | 3910 | std::fmt::Display::fmt(self.syntax(), f) |
3908 | } | 3911 | } |
3909 | } | 3912 | } |
3910 | impl std::fmt::Display for MatchGuard { | 3913 | impl std::fmt::Display for ReferenceType { |
3911 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3914 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3912 | std::fmt::Display::fmt(self.syntax(), f) | 3915 | std::fmt::Display::fmt(self.syntax(), f) |
3913 | } | 3916 | } |
3914 | } | 3917 | } |
3915 | impl std::fmt::Display for RecordExpr { | 3918 | impl std::fmt::Display for SliceType { |
3916 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3919 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3917 | std::fmt::Display::fmt(self.syntax(), f) | 3920 | std::fmt::Display::fmt(self.syntax(), f) |
3918 | } | 3921 | } |
3919 | } | 3922 | } |
3920 | impl std::fmt::Display for RecordExprFieldList { | 3923 | impl std::fmt::Display for TupleType { |
3921 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3924 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3922 | std::fmt::Display::fmt(self.syntax(), f) | 3925 | std::fmt::Display::fmt(self.syntax(), f) |
3923 | } | 3926 | } |
3924 | } | 3927 | } |
3925 | impl std::fmt::Display for RecordExprField { | 3928 | impl std::fmt::Display for TypeBound { |
3926 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3929 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3927 | std::fmt::Display::fmt(self.syntax(), f) | 3930 | std::fmt::Display::fmt(self.syntax(), f) |
3928 | } | 3931 | } |
diff --git a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast index 1c3e0f65b..e0f1d0c27 100644 --- a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast +++ b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast | |||
@@ -12,7 +12,7 @@ [email protected] | |||
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | [email protected] | 14 | [email protected] |
15 | LAMBDA[email protected] | 15 | CLOSURE[email protected] |
16 | [email protected] | 16 | [email protected] |
17 | [email protected] "|" | 17 | [email protected] "|" |
18 | [email protected] "|" | 18 | [email protected] "|" |
diff --git a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast index d62906b99..0afa24b77 100644 --- a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast +++ b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast | |||
@@ -117,7 +117,7 @@ [email protected] | |||
117 | [email protected] | 117 | [email protected] |
118 | [email protected] | 118 | [email protected] |
119 | [email protected] | 119 | [email protected] |
120 | LAMBDA[email protected] | 120 | CLOSURE[email protected] |
121 | [email protected] | 121 | [email protected] |
122 | [email protected] | 122 | [email protected] |
123 | [email protected] | 123 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast index a98c31b0c..0678d4278 100644 --- a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast +++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast | |||
@@ -49,7 +49,7 @@ [email protected] | |||
49 | [email protected] "map" | 49 | [email protected] "map" |
50 | [email protected] | 50 | [email protected] |
51 | [email protected] "(" | 51 | [email protected] "(" |
52 | LAMBDA[email protected] | 52 | CLOSURE[email protected] |
53 | [email protected] | 53 | [email protected] |
54 | [email protected] "|" | 54 | [email protected] "|" |
55 | [email protected] | 55 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast index 51a6c5170..a80d79563 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast | |||
@@ -12,7 +12,7 @@ [email protected] | |||
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | [email protected] | 14 | [email protected] |
15 | LAMBDA[email protected] | 15 | CLOSURE[email protected] |
16 | [email protected] | 16 | [email protected] |
17 | [email protected] "|" | 17 | [email protected] "|" |
18 | [email protected] "|" | 18 | [email protected] "|" |
@@ -23,7 +23,7 @@ [email protected] | |||
23 | [email protected] ";" | 23 | [email protected] ";" |
24 | [email protected] "\n " | 24 | [email protected] "\n " |
25 | [email protected] | 25 | [email protected] |
26 | LAMBDA[email protected] | 26 | CLOSURE[email protected] |
27 | [email protected] | 27 | [email protected] |
28 | [email protected] "|" | 28 | [email protected] "|" |
29 | [email protected] "|" | 29 | [email protected] "|" |
@@ -47,7 +47,7 @@ [email protected] | |||
47 | [email protected] ";" | 47 | [email protected] ";" |
48 | [email protected] "\n " | 48 | [email protected] "\n " |
49 | [email protected] | 49 | [email protected] |
50 | LAMBDA[email protected] | 50 | CLOSURE[email protected] |
51 | [email protected] | 51 | [email protected] |
52 | [email protected] "|" | 52 | [email protected] "|" |
53 | [email protected] | 53 | [email protected] |
@@ -64,7 +64,7 @@ [email protected] | |||
64 | [email protected] ";" | 64 | [email protected] ";" |
65 | [email protected] "\n " | 65 | [email protected] "\n " |
66 | [email protected] | 66 | [email protected] |
67 | LAMBDA[email protected] | 67 | CLOSURE[email protected] |
68 | [email protected] "move" | 68 | [email protected] "move" |
69 | [email protected] " " | 69 | [email protected] " " |
70 | [email protected] | 70 | [email protected] |
@@ -91,7 +91,7 @@ [email protected] | |||
91 | [email protected] ";" | 91 | [email protected] ";" |
92 | [email protected] "\n " | 92 | [email protected] "\n " |
93 | [email protected] | 93 | [email protected] |
94 | LAMBDA[email protected] | 94 | CLOSURE[email protected] |
95 | [email protected] "async" | 95 | [email protected] "async" |
96 | [email protected] " " | 96 | [email protected] " " |
97 | [email protected] | 97 | [email protected] |
@@ -104,7 +104,7 @@ [email protected] | |||
104 | [email protected] ";" | 104 | [email protected] ";" |
105 | [email protected] "\n " | 105 | [email protected] "\n " |
106 | [email protected] | 106 | [email protected] |
107 | LAMBDA[email protected] | 107 | CLOSURE[email protected] |
108 | [email protected] "move" | 108 | [email protected] "move" |
109 | [email protected] " " | 109 | [email protected] " " |
110 | [email protected] | 110 | [email protected] |
@@ -117,7 +117,7 @@ [email protected] | |||
117 | [email protected] ";" | 117 | [email protected] ";" |
118 | [email protected] "\n " | 118 | [email protected] "\n " |
119 | [email protected] | 119 | [email protected] |
120 | LAMBDA[email protected] | 120 | CLOSURE[email protected] |
121 | [email protected] "async" | 121 | [email protected] "async" |
122 | [email protected] " " | 122 | [email protected] " " |
123 | [email protected] "move" | 123 | [email protected] "move" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast index 931e81f27..d2fd6e567 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast | |||
@@ -105,7 +105,7 @@ [email protected] | |||
105 | [email protected] " " | 105 | [email protected] " " |
106 | [email protected] "=" | 106 | [email protected] "=" |
107 | [email protected] " " | 107 | [email protected] " " |
108 | LAMBDA[email protected] | 108 | CLOSURE[email protected] |
109 | [email protected] | 109 | [email protected] |
110 | [email protected] "#" | 110 | [email protected] "#" |
111 | [email protected] "[" | 111 | [email protected] "[" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast index c63a55a56..0a9f7c137 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast | |||
@@ -20,7 +20,7 @@ [email protected] | |||
20 | [email protected] " " | 20 | [email protected] " " |
21 | [email protected] "=" | 21 | [email protected] "=" |
22 | [email protected] " " | 22 | [email protected] " " |
23 | LAMBDA[email protected] | 23 | CLOSURE[email protected] |
24 | [email protected] | 24 | [email protected] |
25 | [email protected] "|" | 25 | [email protected] "|" |
26 | [email protected] | 26 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast index 9c071ec2e..aa4099a92 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast | |||
@@ -13,7 +13,7 @@ [email protected] | |||
13 | [email protected] " " | 13 | [email protected] " " |
14 | [email protected] | 14 | [email protected] |
15 | [email protected] | 15 | [email protected] |
16 | LAMBDA[email protected] | 16 | CLOSURE[email protected] |
17 | [email protected] | 17 | [email protected] |
18 | [email protected] "|" | 18 | [email protected] "|" |
19 | [email protected] "|" | 19 | [email protected] "|" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast index 66cd5727a..1d75ed08f 100644 --- a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast | |||
@@ -351,7 +351,7 @@ [email protected] | |||
351 | [email protected] " " | 351 | [email protected] " " |
352 | [email protected] | 352 | [email protected] |
353 | [email protected] "{" | 353 | [email protected] "{" |
354 | LAMBDA[email protected] | 354 | CLOSURE[email protected] |
355 | [email protected] | 355 | [email protected] |
356 | [email protected] "|" | 356 | [email protected] "|" |
357 | [email protected] "|" | 357 | [email protected] "|" |
@@ -1628,7 +1628,7 @@ [email protected] | |||
1628 | [email protected] | 1628 | [email protected] |
1629 | [email protected] | 1629 | [email protected] |
1630 | [email protected] "(" | 1630 | [email protected] "(" |
1631 | LAMBDA[email protected] | 1631 | CLOSURE[email protected] |
1632 | [email protected] | 1632 | [email protected] |
1633 | [email protected] "|" | 1633 | [email protected] "|" |
1634 | [email protected] | 1634 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast index c9e6d88eb..650f4e310 100644 --- a/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast | |||
@@ -52,7 +52,7 @@ [email protected] | |||
52 | [email protected] "catch_unwind" | 52 | [email protected] "catch_unwind" |
53 | [email protected] | 53 | [email protected] |
54 | [email protected] "(" | 54 | [email protected] "(" |
55 | LAMBDA[email protected] | 55 | CLOSURE[email protected] |
56 | [email protected] "move" | 56 | [email protected] "move" |
57 | [email protected] " " | 57 | [email protected] " " |
58 | [email protected] | 58 | [email protected] |