diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated')
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 76 |
1 files changed, 28 insertions, 48 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 2cb3ad011..5e844d5ae 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -476,13 +476,16 @@ impl LoopExpr { | |||
476 | } | 476 | } |
477 | 477 | ||
478 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 478 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
479 | pub struct TryBlockExpr { | 479 | pub struct EffectExpr { |
480 | pub(crate) syntax: SyntaxNode, | 480 | pub(crate) syntax: SyntaxNode, |
481 | } | 481 | } |
482 | impl ast::AttrsOwner for TryBlockExpr {} | 482 | impl ast::AttrsOwner for EffectExpr {} |
483 | impl TryBlockExpr { | 483 | impl EffectExpr { |
484 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | ||
484 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } | 485 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } |
485 | pub fn body(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | 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) } | ||
486 | } | 489 | } |
487 | 490 | ||
488 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 491 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -551,10 +554,12 @@ pub struct BlockExpr { | |||
551 | pub(crate) syntax: SyntaxNode, | 554 | pub(crate) syntax: SyntaxNode, |
552 | } | 555 | } |
553 | impl ast::AttrsOwner for BlockExpr {} | 556 | impl ast::AttrsOwner for BlockExpr {} |
557 | impl ast::ModuleItemOwner for BlockExpr {} | ||
554 | impl BlockExpr { | 558 | impl BlockExpr { |
555 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | 559 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
556 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | 560 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } |
557 | pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } | 561 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
562 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
558 | } | 563 | } |
559 | 564 | ||
560 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 565 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -626,8 +631,8 @@ pub struct TryExpr { | |||
626 | } | 631 | } |
627 | impl ast::AttrsOwner for TryExpr {} | 632 | impl ast::AttrsOwner for TryExpr {} |
628 | impl TryExpr { | 633 | impl TryExpr { |
629 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } | ||
630 | 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![?]) } | ||
631 | } | 636 | } |
632 | 637 | ||
633 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 638 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -1121,19 +1126,6 @@ impl Condition { | |||
1121 | } | 1126 | } |
1122 | 1127 | ||
1123 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1128 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1124 | pub struct Block { | ||
1125 | pub(crate) syntax: SyntaxNode, | ||
1126 | } | ||
1127 | impl ast::AttrsOwner for Block {} | ||
1128 | impl ast::ModuleItemOwner for Block {} | ||
1129 | impl Block { | ||
1130 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
1131 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } | ||
1132 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1133 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1134 | } | ||
1135 | |||
1136 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1137 | pub struct ParamList { | 1129 | pub struct ParamList { |
1138 | pub(crate) syntax: SyntaxNode, | 1130 | pub(crate) syntax: SyntaxNode, |
1139 | } | 1131 | } |
@@ -1249,6 +1241,9 @@ pub struct PathSegment { | |||
1249 | } | 1241 | } |
1250 | impl PathSegment { | 1242 | impl PathSegment { |
1251 | 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![::]) } |
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]) } | ||
1252 | 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![<]) } |
1253 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 1248 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
1254 | 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) } |
@@ -1473,7 +1468,7 @@ pub enum Expr { | |||
1473 | FieldExpr(FieldExpr), | 1468 | FieldExpr(FieldExpr), |
1474 | AwaitExpr(AwaitExpr), | 1469 | AwaitExpr(AwaitExpr), |
1475 | TryExpr(TryExpr), | 1470 | TryExpr(TryExpr), |
1476 | TryBlockExpr(TryBlockExpr), | 1471 | EffectExpr(EffectExpr), |
1477 | CastExpr(CastExpr), | 1472 | CastExpr(CastExpr), |
1478 | RefExpr(RefExpr), | 1473 | RefExpr(RefExpr), |
1479 | PrefixExpr(PrefixExpr), | 1474 | PrefixExpr(PrefixExpr), |
@@ -1956,8 +1951,8 @@ impl AstNode for LoopExpr { | |||
1956 | } | 1951 | } |
1957 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1952 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1958 | } | 1953 | } |
1959 | impl AstNode for TryBlockExpr { | 1954 | impl AstNode for EffectExpr { |
1960 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_BLOCK_EXPR } | 1955 | fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR } |
1961 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1956 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1962 | if Self::can_cast(syntax.kind()) { | 1957 | if Self::can_cast(syntax.kind()) { |
1963 | Some(Self { syntax }) | 1958 | Some(Self { syntax }) |
@@ -2649,17 +2644,6 @@ impl AstNode for Condition { | |||
2649 | } | 2644 | } |
2650 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2645 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2651 | } | 2646 | } |
2652 | impl AstNode for Block { | ||
2653 | fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK } | ||
2654 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2655 | if Self::can_cast(syntax.kind()) { | ||
2656 | Some(Self { syntax }) | ||
2657 | } else { | ||
2658 | None | ||
2659 | } | ||
2660 | } | ||
2661 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2662 | } | ||
2663 | impl AstNode for ParamList { | 2647 | impl AstNode for ParamList { |
2664 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } | 2648 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } |
2665 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2649 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -3308,8 +3292,8 @@ impl From<AwaitExpr> for Expr { | |||
3308 | impl From<TryExpr> for Expr { | 3292 | impl From<TryExpr> for Expr { |
3309 | fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) } | 3293 | fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) } |
3310 | } | 3294 | } |
3311 | impl From<TryBlockExpr> for Expr { | 3295 | impl From<EffectExpr> for Expr { |
3312 | fn from(node: TryBlockExpr) -> Expr { Expr::TryBlockExpr(node) } | 3296 | fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) } |
3313 | } | 3297 | } |
3314 | impl From<CastExpr> for Expr { | 3298 | impl From<CastExpr> for Expr { |
3315 | fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } | 3299 | fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } |
@@ -3341,9 +3325,10 @@ impl AstNode for Expr { | |||
3341 | 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 |
3342 | | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL | 3326 | | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL |
3343 | | 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 |
3344 | | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | TRY_BLOCK_EXPR | 3328 | | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | EFFECT_EXPR | CAST_EXPR |
3345 | | CAST_EXPR | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | 3329 | | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | BOX_EXPR => { |
3346 | | BOX_EXPR => true, | 3330 | true |
3331 | } | ||
3347 | _ => false, | 3332 | _ => false, |
3348 | } | 3333 | } |
3349 | } | 3334 | } |
@@ -3371,7 +3356,7 @@ impl AstNode for Expr { | |||
3371 | FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), | 3356 | FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), |
3372 | AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), | 3357 | AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), |
3373 | TRY_EXPR => Expr::TryExpr(TryExpr { syntax }), | 3358 | TRY_EXPR => Expr::TryExpr(TryExpr { syntax }), |
3374 | TRY_BLOCK_EXPR => Expr::TryBlockExpr(TryBlockExpr { syntax }), | 3359 | EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }), |
3375 | CAST_EXPR => Expr::CastExpr(CastExpr { syntax }), | 3360 | CAST_EXPR => Expr::CastExpr(CastExpr { syntax }), |
3376 | REF_EXPR => Expr::RefExpr(RefExpr { syntax }), | 3361 | REF_EXPR => Expr::RefExpr(RefExpr { syntax }), |
3377 | PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }), | 3362 | PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }), |
@@ -3408,7 +3393,7 @@ impl AstNode for Expr { | |||
3408 | Expr::FieldExpr(it) => &it.syntax, | 3393 | Expr::FieldExpr(it) => &it.syntax, |
3409 | Expr::AwaitExpr(it) => &it.syntax, | 3394 | Expr::AwaitExpr(it) => &it.syntax, |
3410 | Expr::TryExpr(it) => &it.syntax, | 3395 | Expr::TryExpr(it) => &it.syntax, |
3411 | Expr::TryBlockExpr(it) => &it.syntax, | 3396 | Expr::EffectExpr(it) => &it.syntax, |
3412 | Expr::CastExpr(it) => &it.syntax, | 3397 | Expr::CastExpr(it) => &it.syntax, |
3413 | Expr::RefExpr(it) => &it.syntax, | 3398 | Expr::RefExpr(it) => &it.syntax, |
3414 | Expr::PrefixExpr(it) => &it.syntax, | 3399 | Expr::PrefixExpr(it) => &it.syntax, |
@@ -3889,7 +3874,7 @@ impl std::fmt::Display for LoopExpr { | |||
3889 | std::fmt::Display::fmt(self.syntax(), f) | 3874 | std::fmt::Display::fmt(self.syntax(), f) |
3890 | } | 3875 | } |
3891 | } | 3876 | } |
3892 | impl std::fmt::Display for TryBlockExpr { | 3877 | impl std::fmt::Display for EffectExpr { |
3893 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 3878 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
3894 | std::fmt::Display::fmt(self.syntax(), f) | 3879 | std::fmt::Display::fmt(self.syntax(), f) |
3895 | } | 3880 | } |
@@ -4204,11 +4189,6 @@ impl std::fmt::Display for Condition { | |||
4204 | std::fmt::Display::fmt(self.syntax(), f) | 4189 | std::fmt::Display::fmt(self.syntax(), f) |
4205 | } | 4190 | } |
4206 | } | 4191 | } |
4207 | impl std::fmt::Display for Block { | ||
4208 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
4209 | std::fmt::Display::fmt(self.syntax(), f) | ||
4210 | } | ||
4211 | } | ||
4212 | impl std::fmt::Display for ParamList { | 4192 | impl std::fmt::Display for ParamList { |
4213 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4193 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
4214 | std::fmt::Display::fmt(self.syntax(), f) | 4194 | std::fmt::Display::fmt(self.syntax(), f) |