diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated')
-rw-r--r-- | crates/ra_syntax/src/ast/generated/nodes.rs | 85 |
1 files changed, 49 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..c2cc25958 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -12,6 +12,7 @@ pub struct SourceFile { | |||
12 | } | 12 | } |
13 | impl ast::ModuleItemOwner for SourceFile {} | 13 | impl ast::ModuleItemOwner for SourceFile {} |
14 | impl ast::AttrsOwner for SourceFile {} | 14 | impl ast::AttrsOwner for SourceFile {} |
15 | impl ast::DocCommentsOwner for SourceFile {} | ||
15 | impl SourceFile { | 16 | impl SourceFile { |
16 | pub fn modules(&self) -> AstChildren<Module> { support::children(&self.syntax) } | 17 | pub fn modules(&self) -> AstChildren<Module> { support::children(&self.syntax) } |
17 | } | 18 | } |
@@ -259,6 +260,7 @@ pub struct ImplDef { | |||
259 | } | 260 | } |
260 | impl ast::TypeParamsOwner for ImplDef {} | 261 | impl ast::TypeParamsOwner for ImplDef {} |
261 | impl ast::AttrsOwner for ImplDef {} | 262 | impl ast::AttrsOwner for ImplDef {} |
263 | impl ast::DocCommentsOwner for ImplDef {} | ||
262 | impl ImplDef { | 264 | impl ImplDef { |
263 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | 265 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
264 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | 266 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
@@ -476,6 +478,19 @@ impl LoopExpr { | |||
476 | } | 478 | } |
477 | 479 | ||
478 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 480 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
481 | pub struct EffectExpr { | ||
482 | pub(crate) syntax: SyntaxNode, | ||
483 | } | ||
484 | impl ast::AttrsOwner for EffectExpr {} | ||
485 | impl EffectExpr { | ||
486 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | ||
487 | pub fn try_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![try]) } | ||
488 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | ||
489 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | ||
490 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | ||
491 | } | ||
492 | |||
493 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
479 | pub struct ForExpr { | 494 | pub struct ForExpr { |
480 | pub(crate) syntax: SyntaxNode, | 495 | pub(crate) syntax: SyntaxNode, |
481 | } | 496 | } |
@@ -541,11 +556,12 @@ pub struct BlockExpr { | |||
541 | pub(crate) syntax: SyntaxNode, | 556 | pub(crate) syntax: SyntaxNode, |
542 | } | 557 | } |
543 | impl ast::AttrsOwner for BlockExpr {} | 558 | impl ast::AttrsOwner for BlockExpr {} |
559 | impl ast::ModuleItemOwner for BlockExpr {} | ||
544 | impl BlockExpr { | 560 | impl BlockExpr { |
545 | pub fn label(&self) -> Option<Label> { support::child(&self.syntax) } | 561 | 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]) } | 562 | pub fn statements(&self) -> AstChildren<Stmt> { support::children(&self.syntax) } |
547 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | 563 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
548 | pub fn block(&self) -> Option<Block> { support::child(&self.syntax) } | 564 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
549 | } | 565 | } |
550 | 566 | ||
551 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 567 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -617,8 +633,8 @@ pub struct TryExpr { | |||
617 | } | 633 | } |
618 | impl ast::AttrsOwner for TryExpr {} | 634 | impl ast::AttrsOwner for TryExpr {} |
619 | impl TryExpr { | 635 | 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) } | 636 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
637 | pub fn question_mark_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![?]) } | ||
622 | } | 638 | } |
623 | 639 | ||
624 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 640 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -1112,19 +1128,6 @@ impl Condition { | |||
1112 | } | 1128 | } |
1113 | 1129 | ||
1114 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1130 | #[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 { | 1131 | pub struct ParamList { |
1129 | pub(crate) syntax: SyntaxNode, | 1132 | pub(crate) syntax: SyntaxNode, |
1130 | } | 1133 | } |
@@ -1241,6 +1244,8 @@ pub struct PathSegment { | |||
1241 | impl PathSegment { | 1244 | impl PathSegment { |
1242 | pub fn coloncolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![::]) } | 1245 | 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]) } | 1246 | pub fn crate_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![crate]) } |
1247 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
1248 | 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![<]) } | 1249 | 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) } | 1250 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
1246 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } | 1251 | pub fn type_arg_list(&self) -> Option<TypeArgList> { support::child(&self.syntax) } |
@@ -1465,6 +1470,7 @@ pub enum Expr { | |||
1465 | FieldExpr(FieldExpr), | 1470 | FieldExpr(FieldExpr), |
1466 | AwaitExpr(AwaitExpr), | 1471 | AwaitExpr(AwaitExpr), |
1467 | TryExpr(TryExpr), | 1472 | TryExpr(TryExpr), |
1473 | EffectExpr(EffectExpr), | ||
1468 | CastExpr(CastExpr), | 1474 | CastExpr(CastExpr), |
1469 | RefExpr(RefExpr), | 1475 | RefExpr(RefExpr), |
1470 | PrefixExpr(PrefixExpr), | 1476 | PrefixExpr(PrefixExpr), |
@@ -1947,6 +1953,17 @@ impl AstNode for LoopExpr { | |||
1947 | } | 1953 | } |
1948 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1954 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1949 | } | 1955 | } |
1956 | impl AstNode for EffectExpr { | ||
1957 | fn can_cast(kind: SyntaxKind) -> bool { kind == EFFECT_EXPR } | ||
1958 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1959 | if Self::can_cast(syntax.kind()) { | ||
1960 | Some(Self { syntax }) | ||
1961 | } else { | ||
1962 | None | ||
1963 | } | ||
1964 | } | ||
1965 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1966 | } | ||
1950 | impl AstNode for ForExpr { | 1967 | impl AstNode for ForExpr { |
1951 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } | 1968 | fn can_cast(kind: SyntaxKind) -> bool { kind == FOR_EXPR } |
1952 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1969 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2629,17 +2646,6 @@ impl AstNode for Condition { | |||
2629 | } | 2646 | } |
2630 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2647 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2631 | } | 2648 | } |
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 { | 2649 | impl AstNode for ParamList { |
2644 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } | 2650 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM_LIST } |
2645 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2651 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -3288,6 +3294,9 @@ impl From<AwaitExpr> for Expr { | |||
3288 | impl From<TryExpr> for Expr { | 3294 | impl From<TryExpr> for Expr { |
3289 | fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) } | 3295 | fn from(node: TryExpr) -> Expr { Expr::TryExpr(node) } |
3290 | } | 3296 | } |
3297 | impl From<EffectExpr> for Expr { | ||
3298 | fn from(node: EffectExpr) -> Expr { Expr::EffectExpr(node) } | ||
3299 | } | ||
3291 | impl From<CastExpr> for Expr { | 3300 | impl From<CastExpr> for Expr { |
3292 | fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } | 3301 | fn from(node: CastExpr) -> Expr { Expr::CastExpr(node) } |
3293 | } | 3302 | } |
@@ -3318,8 +3327,10 @@ impl AstNode for Expr { | |||
3318 | TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR | 3327 | TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR |
3319 | | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL | 3328 | | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL |
3320 | | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_LIT | CALL_EXPR | INDEX_EXPR | 3329 | | 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 | 3330 | | 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, | 3331 | | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | BOX_EXPR => { |
3332 | true | ||
3333 | } | ||
3323 | _ => false, | 3334 | _ => false, |
3324 | } | 3335 | } |
3325 | } | 3336 | } |
@@ -3347,6 +3358,7 @@ impl AstNode for Expr { | |||
3347 | FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), | 3358 | FIELD_EXPR => Expr::FieldExpr(FieldExpr { syntax }), |
3348 | AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), | 3359 | AWAIT_EXPR => Expr::AwaitExpr(AwaitExpr { syntax }), |
3349 | TRY_EXPR => Expr::TryExpr(TryExpr { syntax }), | 3360 | TRY_EXPR => Expr::TryExpr(TryExpr { syntax }), |
3361 | EFFECT_EXPR => Expr::EffectExpr(EffectExpr { syntax }), | ||
3350 | CAST_EXPR => Expr::CastExpr(CastExpr { syntax }), | 3362 | CAST_EXPR => Expr::CastExpr(CastExpr { syntax }), |
3351 | REF_EXPR => Expr::RefExpr(RefExpr { syntax }), | 3363 | REF_EXPR => Expr::RefExpr(RefExpr { syntax }), |
3352 | PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }), | 3364 | PREFIX_EXPR => Expr::PrefixExpr(PrefixExpr { syntax }), |
@@ -3383,6 +3395,7 @@ impl AstNode for Expr { | |||
3383 | Expr::FieldExpr(it) => &it.syntax, | 3395 | Expr::FieldExpr(it) => &it.syntax, |
3384 | Expr::AwaitExpr(it) => &it.syntax, | 3396 | Expr::AwaitExpr(it) => &it.syntax, |
3385 | Expr::TryExpr(it) => &it.syntax, | 3397 | Expr::TryExpr(it) => &it.syntax, |
3398 | Expr::EffectExpr(it) => &it.syntax, | ||
3386 | Expr::CastExpr(it) => &it.syntax, | 3399 | Expr::CastExpr(it) => &it.syntax, |
3387 | Expr::RefExpr(it) => &it.syntax, | 3400 | Expr::RefExpr(it) => &it.syntax, |
3388 | Expr::PrefixExpr(it) => &it.syntax, | 3401 | Expr::PrefixExpr(it) => &it.syntax, |
@@ -3863,6 +3876,11 @@ impl std::fmt::Display for LoopExpr { | |||
3863 | std::fmt::Display::fmt(self.syntax(), f) | 3876 | std::fmt::Display::fmt(self.syntax(), f) |
3864 | } | 3877 | } |
3865 | } | 3878 | } |
3879 | impl std::fmt::Display for EffectExpr { | ||
3880 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
3881 | std::fmt::Display::fmt(self.syntax(), f) | ||
3882 | } | ||
3883 | } | ||
3866 | impl std::fmt::Display for ForExpr { | 3884 | impl std::fmt::Display for ForExpr { |
3867 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 3885 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
3868 | std::fmt::Display::fmt(self.syntax(), f) | 3886 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -4173,11 +4191,6 @@ impl std::fmt::Display for Condition { | |||
4173 | std::fmt::Display::fmt(self.syntax(), f) | 4191 | std::fmt::Display::fmt(self.syntax(), f) |
4174 | } | 4192 | } |
4175 | } | 4193 | } |
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 { | 4194 | impl std::fmt::Display for ParamList { |
4182 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 4195 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
4183 | std::fmt::Display::fmt(self.syntax(), f) | 4196 | std::fmt::Display::fmt(self.syntax(), f) |