diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated/nodes.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 83 |
1 files changed, 47 insertions, 36 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 81260680f..5e844d5ae 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -476,6 +476,19 @@ impl LoopExpr { | |||
476 | } | 476 | } |
477 | 477 | ||
478 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 478 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
479 | pub struct EffectExpr { | ||
480 | pub(crate) syntax: SyntaxNode, | ||
481 | } | ||
482 | impl ast::AttrsOwner for EffectExpr {} | ||
483 | impl EffectExpr { | ||
484 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | ||
485 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } | ||
486 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
487 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | ||
488 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | ||
489 | } | ||
490 | |||
491 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
479 | pub struct ForExpr { | 492 | pub struct ForExpr { |
480 | pub(crate) syntax: SyntaxNode, | 493 | pub(crate) syntax: SyntaxNode, |
481 | } | 494 | } |
@@ -541,11 +554,12 @@ pub struct BlockExpr { | |||
541 | pub(crate) syntax: SyntaxNode, | 554 | pub(crate) syntax: SyntaxNode, |
542 | } | 555 | } |
543 | impl ast::AttrsOwner for BlockExpr {} | 556 | impl ast::AttrsOwner for BlockExpr {} |
557 | impl ast::ModuleItemOwner for BlockExpr {} | ||
544 | impl BlockExpr { | 558 | impl BlockExpr { |
545 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | 559 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
546 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | 560 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } |
547 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | 561 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
548 | pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } | 562 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
549 | } | 563 | } |
550 | 564 | ||
551 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 565 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -617,8 +631,8 @@ pub struct TryExpr { | |||
617 | } | 631 | } |
618 | impl ast::AttrsOwner for TryExpr {} | 632 | impl ast::AttrsOwner for TryExpr {} |
619 | impl TryExpr { | 633 | impl TryExpr { |
620 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } | ||
621 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 634 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
635 | pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } | ||
622 | } | 636 | } |
623 | 637 | ||
624 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 638 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -1112,19 +1126,6 @@ impl Condition { | |||
1112 | } | 1126 | } |
1113 | 1127 | ||
1114 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1128 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1115 | pub struct Block { | ||
1116 | pub(crate) syntax: SyntaxNode, | ||
1117 | } | ||
1118 | impl ast::AttrsOwner for Block {} | ||
1119 | impl ast::ModuleItemOwner for Block {} | ||
1120 | impl Block { | ||
1121 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
1122 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | ||
1123 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1124 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1125 | } | ||
1126 | |||
1127 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1128 | pub struct ParamList { | 1129 | pub struct ParamList { |
1129 | pub(crate) syntax: SyntaxNode, | 1130 | pub(crate) syntax: SyntaxNode, |
1130 | } | 1131 | } |
@@ -1241,6 +1242,8 @@ pub struct PathSegment { | |||
1241 | impl PathSegment { | 1242 | impl PathSegment { |
1242 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | 1243 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } |
1243 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } | 1244 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } |
1245 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
1246 | pub fn super_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![super]) } | ||
1244 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | 1247 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } |
1245 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 1248 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
1246 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | 1249 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } |
@@ -1465,6 +1468,7 @@ pub enum Expr { | |||
1465 | FieldExpr(FieldExpr), | 1468 | FieldExpr(FieldExpr), |
1466 | AwaitExpr(AwaitExpr), | 1469 | AwaitExpr(AwaitExpr), |
1467 | TryExpr(TryExpr), | 1470 | TryExpr(TryExpr), |
1471 | EffectExpr(EffectExpr), | ||
1468 | CastExpr(CastExpr), | 1472 | CastExpr(CastExpr), |
1469 | RefExpr(RefExpr), | 1473 | RefExpr(RefExpr), |
1470 | PrefixExpr(PrefixExpr), | 1474 | PrefixExpr(PrefixExpr), |
@@ -1947,6 +1951,17 @@ impl AstNode for LoopExpr { | |||
1947 | } | 1951 | } |
1948 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1952 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1949 | } | 1953 | } |
1954 | impl AstNode for EffectExpr { | ||
1955 | fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR } | ||
1956 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1957 | if Self::can_cast(syntax.kind()) { | ||
1958 | Some(Self { syntax }) | ||
1959 | } else { | ||
1960 | None | ||
1961 | } | ||
1962 | } | ||
1963 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1964 | } | ||
1950 | impl AstNode for ForExpr { | 1965 | impl AstNode for ForExpr { |
1951 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } | 1966 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } |
1952 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1967 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2629,17 +2644,6 @@ impl AstNode for Condition { | |||
2629 | } | 2644 | } |
2630 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2645 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2631 | } | 2646 | } |
2632 | impl AstNode for Block { | ||
2633 | fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK } | ||
2634 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2635 | if Self::can_cast(syntax.kind()) { | ||
2636 | Some(Self { syntax }) | ||
2637 | } else { | ||
2638 | None | ||
2639 | } | ||
2640 | } | ||
2641 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2642 | } | ||
2643 | impl AstNode for ParamList { | 2647 | impl AstNode for ParamList { |
2644 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } | 2648 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } |
2645 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2649 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -3288,6 +3292,9 @@ impl From<AwaitExpr> for Expr { | |||
3288 | impl From<TryExpr> for Expr { | 3292 | impl From<TryExpr> for Expr { |
3289 | fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) } | 3293 | fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) } |
3290 | } | 3294 | } |
3295 | impl From<EffectExpr> for Expr { | ||
3296 | fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) } | ||
3297 | } | ||
3291 | impl From<CastExpr> for Expr { | 3298 | impl From<CastExpr> for Expr { |
3292 | fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } | 3299 | fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } |
3293 | } | 3300 | } |
@@ -3318,8 +3325,10 @@ impl AstNode for Expr { | |||
3318 | TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR | 3325 | TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR |
3319 | | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL | 3326 | | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL |
3320 | | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_LIT | CALL_EXPR | INDEX_EXPR | 3327 | | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_LIT | CALL_EXPR | INDEX_EXPR |
3321 | | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | CAST_EXPR | REF_EXPR | 3328 | | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | EFFECT_EXPR | CAST_EXPR |
3322 | | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | BOX_EXPR => true, | 3329 | | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | BOX_EXPR => { |
3330 | true | ||
3331 | } | ||
3323 | _ => false, | 3332 | _ => false, |
3324 | } | 3333 | } |
3325 | } | 3334 | } |
@@ -3347,6 +3356,7 @@ impl AstNode for Expr { | |||
3347 | FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), | 3356 | FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), |
3348 | AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), | 3357 | AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), |
3349 | TRY_EXPR => Expr::TryExpr(TryExpr { syntax }), | 3358 | TRY_EXPR => Expr::TryExpr(TryExpr { syntax }), |
3359 | EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }), | ||
3350 | CAST_EXPR => Expr::CastExpr(CastExpr { syntax }), | 3360 | CAST_EXPR => Expr::CastExpr(CastExpr { syntax }), |
3351 | REF_EXPR => Expr::RefExpr(RefExpr { syntax }), | 3361 | REF_EXPR => Expr::RefExpr(RefExpr { syntax }), |
3352 | PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }), | 3362 | PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }), |
@@ -3383,6 +3393,7 @@ impl AstNode for Expr { | |||
3383 | Expr::FieldExpr(it) => &it.syntax, | 3393 | Expr::FieldExpr(it) => &it.syntax, |
3384 | Expr::AwaitExpr(it) => &it.syntax, | 3394 | Expr::AwaitExpr(it) => &it.syntax, |
3385 | Expr::TryExpr(it) => &it.syntax, | 3395 | Expr::TryExpr(it) => &it.syntax, |
3396 | Expr::EffectExpr(it) => &it.syntax, | ||
3386 | Expr::CastExpr(it) => &it.syntax, | 3397 | Expr::CastExpr(it) => &it.syntax, |
3387 | Expr::RefExpr(it) => &it.syntax, | 3398 | Expr::RefExpr(it) => &it.syntax, |
3388 | Expr::PrefixExpr(it) => &it.syntax, | 3399 | Expr::PrefixExpr(it) => &it.syntax, |
@@ -3863,6 +3874,11 @@ impl std::fmt::Display for LoopExpr { | |||
3863 | std::fmt::Display::fmt(self.syntax(), f) | 3874 | std::fmt::Display::fmt(self.syntax(), f) |
3864 | } | 3875 | } |
3865 | } | 3876 | } |
3877 | impl std::fmt::Display for EffectExpr { | ||
3878 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3879 | std::fmt::Display::fmt(self.syntax(), f) | ||
3880 | } | ||
3881 | } | ||
3866 | impl std::fmt::Display for ForExpr { | 3882 | impl std::fmt::Display for ForExpr { |
3867 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 3883 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
3868 | std::fmt::Display::fmt(self.syntax(), f) | 3884 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -4173,11 +4189,6 @@ impl std::fmt::Display for Condition { | |||
4173 | std::fmt::Display::fmt(self.syntax(), f) | 4189 | std::fmt::Display::fmt(self.syntax(), f) |
4174 | } | 4190 | } |
4175 | } | 4191 | } |
4176 | impl std::fmt::Display for Block { | ||
4177 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
4178 | std::fmt::Display::fmt(self.syntax(), f) | ||
4179 | } | ||
4180 | } | ||
4181 | impl std::fmt::Display for ParamList { | 4192 | impl std::fmt::Display for ParamList { |
4182 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4193 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
4183 | std::fmt::Display::fmt(self.syntax(), f) | 4194 | std::fmt::Display::fmt(self.syntax(), f) |