aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/generated
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-05-02 00:18:19 +0100
committerAleksey Kladov <[email protected]>2020-05-02 10:21:39 +0100
commit4f2134cc33f07c09fe166cec42971828843bc0ef (patch)
tree0e2440d51717dd0dfcefbf77e5ef546f1ee5c60d /crates/ra_syntax/src/ast/generated
parent3c96de5380a09fe06752ce146edeb017ae8c701c (diff)
Introduce EffectExpr
Diffstat (limited to 'crates/ra_syntax/src/ast/generated')
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs74
1 files changed, 25 insertions, 49 deletions
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 2096f12f1..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)]
479pub struct TryBlockExpr { 479pub struct EffectExpr {
480 pub(crate) syntax: SyntaxNode, 480 pub(crate) syntax: SyntaxNode,
481} 481}
482impl ast::AttrsOwner for TryBlockExpr {} 482impl ast::AttrsOwner for EffectExpr {}
483impl TryBlockExpr { 483impl 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,11 +554,12 @@ pub struct BlockExpr {
551 pub(crate) syntax: SyntaxNode, 554 pub(crate) syntax: SyntaxNode,
552} 555}
553impl ast::AttrsOwner for BlockExpr {} 556impl ast::AttrsOwner for BlockExpr {}
557impl ast::ModuleItemOwner for BlockExpr {}
554impl BlockExpr { 558impl 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 async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } 561 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
558 pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } 562 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
559} 563}
560 564
561#[derive(Debug, Clone, PartialEq, Eq, Hash)] 565#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -627,8 +631,8 @@ pub struct TryExpr {
627} 631}
628impl ast::AttrsOwner for TryExpr {} 632impl ast::AttrsOwner for TryExpr {}
629impl TryExpr { 633impl TryExpr {
630 pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) }
631 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![?]) }
632} 636}
633 637
634#[derive(Debug, Clone, PartialEq, Eq, Hash)] 638#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -1122,19 +1126,6 @@ impl Condition {
1122} 1126}
1123 1127
1124#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1128#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1125pub struct Block {
1126 pub(crate) syntax: SyntaxNode,
1127}
1128impl ast::AttrsOwner for Block {}
1129impl ast::ModuleItemOwner for Block {}
1130impl Block {
1131 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
1132 pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) }
1133 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
1134 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
1135}
1136
1137#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1138pub struct ParamList { 1129pub struct ParamList {
1139 pub(crate) syntax: SyntaxNode, 1130 pub(crate) syntax: SyntaxNode,
1140} 1131}
@@ -1477,7 +1468,7 @@ pub enum Expr {
1477 FieldExpr(FieldExpr), 1468 FieldExpr(FieldExpr),
1478 AwaitExpr(AwaitExpr), 1469 AwaitExpr(AwaitExpr),
1479 TryExpr(TryExpr), 1470 TryExpr(TryExpr),
1480 TryBlockExpr(TryBlockExpr), 1471 EffectExpr(EffectExpr),
1481 CastExpr(CastExpr), 1472 CastExpr(CastExpr),
1482 RefExpr(RefExpr), 1473 RefExpr(RefExpr),
1483 PrefixExpr(PrefixExpr), 1474 PrefixExpr(PrefixExpr),
@@ -1960,8 +1951,8 @@ impl AstNode for LoopExpr {
1960 } 1951 }
1961 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1952 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1962} 1953}
1963impl AstNode for TryBlockExpr { 1954impl AstNode for EffectExpr {
1964 fn can_cast(kind: SyntaxKind) -> bool { kind == TRY_BLOCK_EXPR } 1955 fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR }
1965 fn cast(syntax: SyntaxNode) -> Option<Self> { 1956 fn cast(syntax: SyntaxNode) -> Option<Self> {
1966 if Self::can_cast(syntax.kind()) { 1957 if Self::can_cast(syntax.kind()) {
1967 Some(Self { syntax }) 1958 Some(Self { syntax })
@@ -2653,17 +2644,6 @@ impl AstNode for Condition {
2653 } 2644 }
2654 fn syntax(&self) -> &SyntaxNode { &self.syntax } 2645 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2655} 2646}
2656impl AstNode for Block {
2657 fn can_cast(kind: SyntaxKind) -> bool { kind == BLOCK }
2658 fn cast(syntax: SyntaxNode) -> Option<Self> {
2659 if Self::can_cast(syntax.kind()) {
2660 Some(Self { syntax })
2661 } else {
2662 None
2663 }
2664 }
2665 fn syntax(&self) -> &SyntaxNode { &self.syntax }
2666}
2667impl AstNode for ParamList { 2647impl AstNode for ParamList {
2668 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } 2648 fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST }
2669 fn cast(syntax: SyntaxNode) -> Option<Self> { 2649 fn cast(syntax: SyntaxNode) -> Option<Self> {
@@ -3312,8 +3292,8 @@ impl From<AwaitExpr> for Expr {
3312impl From<TryExpr> for Expr { 3292impl From<TryExpr> for Expr {
3313 fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) } 3293 fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) }
3314} 3294}
3315impl From<TryBlockExpr> for Expr { 3295impl From<EffectExpr> for Expr {
3316 fn from(node: TryBlockExpr) -> Expr { Expr::TryBlockExpr(node) } 3296 fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) }
3317} 3297}
3318impl From<CastExpr> for Expr { 3298impl From<CastExpr> for Expr {
3319 fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } 3299 fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) }
@@ -3345,9 +3325,10 @@ impl AstNode for Expr {
3345 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
3346 | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL 3326 | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL
3347 | 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
3348 | 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
3349 | 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 => {
3350 | BOX_EXPR => true, 3330 true
3331 }
3351 _ => false, 3332 _ => false,
3352 } 3333 }
3353 } 3334 }
@@ -3375,7 +3356,7 @@ impl AstNode for Expr {
3375 FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), 3356 FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }),
3376 AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), 3357 AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }),
3377 TRY_EXPR => Expr::TryExpr(TryExpr { syntax }), 3358 TRY_EXPR => Expr::TryExpr(TryExpr { syntax }),
3378 TRY_BLOCK_EXPR => Expr::TryBlockExpr(TryBlockExpr { syntax }), 3359 EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }),
3379 CAST_EXPR => Expr::CastExpr(CastExpr { syntax }), 3360 CAST_EXPR => Expr::CastExpr(CastExpr { syntax }),
3380 REF_EXPR => Expr::RefExpr(RefExpr { syntax }), 3361 REF_EXPR => Expr::RefExpr(RefExpr { syntax }),
3381 PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }), 3362 PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }),
@@ -3412,7 +3393,7 @@ impl AstNode for Expr {
3412 Expr::FieldExpr(it) => &it.syntax, 3393 Expr::FieldExpr(it) => &it.syntax,
3413 Expr::AwaitExpr(it) => &it.syntax, 3394 Expr::AwaitExpr(it) => &it.syntax,
3414 Expr::TryExpr(it) => &it.syntax, 3395 Expr::TryExpr(it) => &it.syntax,
3415 Expr::TryBlockExpr(it) => &it.syntax, 3396 Expr::EffectExpr(it) => &it.syntax,
3416 Expr::CastExpr(it) => &it.syntax, 3397 Expr::CastExpr(it) => &it.syntax,
3417 Expr::RefExpr(it) => &it.syntax, 3398 Expr::RefExpr(it) => &it.syntax,
3418 Expr::PrefixExpr(it) => &it.syntax, 3399 Expr::PrefixExpr(it) => &it.syntax,
@@ -3893,7 +3874,7 @@ impl std::fmt::Display for LoopExpr {
3893 std::fmt::Display::fmt(self.syntax(), f) 3874 std::fmt::Display::fmt(self.syntax(), f)
3894 } 3875 }
3895} 3876}
3896impl std::fmt::Display for TryBlockExpr { 3877impl std::fmt::Display for EffectExpr {
3897 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 3878 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
3898 std::fmt::Display::fmt(self.syntax(), f) 3879 std::fmt::Display::fmt(self.syntax(), f)
3899 } 3880 }
@@ -4208,11 +4189,6 @@ impl std::fmt::Display for Condition {
4208 std::fmt::Display::fmt(self.syntax(), f) 4189 std::fmt::Display::fmt(self.syntax(), f)
4209 } 4190 }
4210} 4191}
4211impl std::fmt::Display for Block {
4212 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4213 std::fmt::Display::fmt(self.syntax(), f)
4214 }
4215}
4216impl std::fmt::Display for ParamList { 4192impl std::fmt::Display for ParamList {
4217 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 4193 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
4218 std::fmt::Display::fmt(self.syntax(), f) 4194 std::fmt::Display::fmt(self.syntax(), f)