diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-09 12:00:55 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-09 12:00:55 +0100 |
commit | cfc127f52988cf4f95797cb355398e3af32632aa (patch) | |
tree | a974bfe4160a0cb0d49146b239d68cdb99a6566d /crates/ra_syntax/src/ast/generated.rs | |
parent | 85956932872481cf4813c5e7794d981a9edb4623 (diff) | |
parent | 689661c95968cb438f8bd1f10ce0ee096287741b (diff) |
Merge #3911
3911: Genrate token accessors r=matklad a=matklad
bors r+
🤖
Co-authored-by: Luca Barbieri <[email protected]>
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 2091 |
1 files changed, 1920 insertions, 171 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 385fddc89..bd92e9c87 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | #[allow(unused_imports)] | 3 | #[allow(unused_imports)] |
4 | use crate::{ | 4 | use crate::{ |
5 | ast::{self, AstChildren, AstNode, AstToken}, | 5 | ast::{self, support, AstChildren, AstNode, AstToken}, |
6 | NodeOrToken, SyntaxElement, | 6 | NodeOrToken, SyntaxElement, |
7 | SyntaxKind::{self, *}, | 7 | SyntaxKind::{self, *}, |
8 | SyntaxNode, SyntaxToken, | 8 | SyntaxNode, SyntaxToken, |
@@ -2600,6 +2600,33 @@ impl AstToken for UnionKw { | |||
2600 | } | 2600 | } |
2601 | } | 2601 | } |
2602 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 2602 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
2603 | pub struct RawKw { | ||
2604 | pub(crate) syntax: SyntaxToken, | ||
2605 | } | ||
2606 | impl std::fmt::Display for RawKw { | ||
2607 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
2608 | std::fmt::Display::fmt(&self.syntax, f) | ||
2609 | } | ||
2610 | } | ||
2611 | impl AstToken for RawKw { | ||
2612 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2613 | match kind { | ||
2614 | RAW_KW => true, | ||
2615 | _ => false, | ||
2616 | } | ||
2617 | } | ||
2618 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
2619 | if Self::can_cast(syntax.kind()) { | ||
2620 | Some(Self { syntax }) | ||
2621 | } else { | ||
2622 | None | ||
2623 | } | ||
2624 | } | ||
2625 | fn syntax(&self) -> &SyntaxToken { | ||
2626 | &self.syntax | ||
2627 | } | ||
2628 | } | ||
2629 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
2603 | pub struct IntNumber { | 2630 | pub struct IntNumber { |
2604 | pub(crate) syntax: SyntaxToken, | 2631 | pub(crate) syntax: SyntaxToken, |
2605 | } | 2632 | } |
@@ -3060,9 +3087,10 @@ impl AstNode for SourceFile { | |||
3060 | } | 3087 | } |
3061 | impl ast::ModuleItemOwner for SourceFile {} | 3088 | impl ast::ModuleItemOwner for SourceFile {} |
3062 | impl ast::FnDefOwner for SourceFile {} | 3089 | impl ast::FnDefOwner for SourceFile {} |
3090 | impl ast::AttrsOwner for SourceFile {} | ||
3063 | impl SourceFile { | 3091 | impl SourceFile { |
3064 | pub fn modules(&self) -> AstChildren<Module> { | 3092 | pub fn modules(&self) -> AstChildren<Module> { |
3065 | AstChildren::new(&self.syntax) | 3093 | support::children(&self.syntax) |
3066 | } | 3094 | } |
3067 | } | 3095 | } |
3068 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3096 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3098,14 +3126,35 @@ impl ast::TypeParamsOwner for FnDef {} | |||
3098 | impl ast::DocCommentsOwner for FnDef {} | 3126 | impl ast::DocCommentsOwner for FnDef {} |
3099 | impl ast::AttrsOwner for FnDef {} | 3127 | impl ast::AttrsOwner for FnDef {} |
3100 | impl FnDef { | 3128 | impl FnDef { |
3129 | pub fn abi(&self) -> Option<Abi> { | ||
3130 | support::child(&self.syntax) | ||
3131 | } | ||
3132 | pub fn const_kw(&self) -> Option<ConstKw> { | ||
3133 | support::token(&self.syntax) | ||
3134 | } | ||
3135 | pub fn default_kw(&self) -> Option<DefaultKw> { | ||
3136 | support::token(&self.syntax) | ||
3137 | } | ||
3138 | pub fn async_kw(&self) -> Option<AsyncKw> { | ||
3139 | support::token(&self.syntax) | ||
3140 | } | ||
3141 | pub fn unsafe_kw(&self) -> Option<UnsafeKw> { | ||
3142 | support::token(&self.syntax) | ||
3143 | } | ||
3144 | pub fn fn_kw(&self) -> Option<FnKw> { | ||
3145 | support::token(&self.syntax) | ||
3146 | } | ||
3101 | pub fn param_list(&self) -> Option<ParamList> { | 3147 | pub fn param_list(&self) -> Option<ParamList> { |
3102 | AstChildren::new(&self.syntax).next() | 3148 | support::child(&self.syntax) |
3103 | } | 3149 | } |
3104 | pub fn ret_type(&self) -> Option<RetType> { | 3150 | pub fn ret_type(&self) -> Option<RetType> { |
3105 | AstChildren::new(&self.syntax).next() | 3151 | support::child(&self.syntax) |
3106 | } | 3152 | } |
3107 | pub fn body(&self) -> Option<BlockExpr> { | 3153 | pub fn body(&self) -> Option<BlockExpr> { |
3108 | AstChildren::new(&self.syntax).next() | 3154 | support::child(&self.syntax) |
3155 | } | ||
3156 | pub fn semi(&self) -> Option<Semi> { | ||
3157 | support::token(&self.syntax) | ||
3109 | } | 3158 | } |
3110 | } | 3159 | } |
3111 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3160 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3136,8 +3185,11 @@ impl AstNode for RetType { | |||
3136 | } | 3185 | } |
3137 | } | 3186 | } |
3138 | impl RetType { | 3187 | impl RetType { |
3188 | pub fn thin_arrow(&self) -> Option<ThinArrow> { | ||
3189 | support::token(&self.syntax) | ||
3190 | } | ||
3139 | pub fn type_ref(&self) -> Option<TypeRef> { | 3191 | pub fn type_ref(&self) -> Option<TypeRef> { |
3140 | AstChildren::new(&self.syntax).next() | 3192 | support::child(&self.syntax) |
3141 | } | 3193 | } |
3142 | } | 3194 | } |
3143 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3195 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3172,7 +3224,17 @@ impl ast::NameOwner for StructDef {} | |||
3172 | impl ast::TypeParamsOwner for StructDef {} | 3224 | impl ast::TypeParamsOwner for StructDef {} |
3173 | impl ast::AttrsOwner for StructDef {} | 3225 | impl ast::AttrsOwner for StructDef {} |
3174 | impl ast::DocCommentsOwner for StructDef {} | 3226 | impl ast::DocCommentsOwner for StructDef {} |
3175 | impl StructDef {} | 3227 | impl StructDef { |
3228 | pub fn struct_kw(&self) -> Option<StructKw> { | ||
3229 | support::token(&self.syntax) | ||
3230 | } | ||
3231 | pub fn field_def_list(&self) -> Option<FieldDefList> { | ||
3232 | support::child(&self.syntax) | ||
3233 | } | ||
3234 | pub fn semi(&self) -> Option<Semi> { | ||
3235 | support::token(&self.syntax) | ||
3236 | } | ||
3237 | } | ||
3176 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3238 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3177 | pub struct UnionDef { | 3239 | pub struct UnionDef { |
3178 | pub(crate) syntax: SyntaxNode, | 3240 | pub(crate) syntax: SyntaxNode, |
@@ -3206,8 +3268,11 @@ impl ast::TypeParamsOwner for UnionDef {} | |||
3206 | impl ast::AttrsOwner for UnionDef {} | 3268 | impl ast::AttrsOwner for UnionDef {} |
3207 | impl ast::DocCommentsOwner for UnionDef {} | 3269 | impl ast::DocCommentsOwner for UnionDef {} |
3208 | impl UnionDef { | 3270 | impl UnionDef { |
3271 | pub fn union_kw(&self) -> Option<UnionKw> { | ||
3272 | support::token(&self.syntax) | ||
3273 | } | ||
3209 | pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { | 3274 | pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { |
3210 | AstChildren::new(&self.syntax).next() | 3275 | support::child(&self.syntax) |
3211 | } | 3276 | } |
3212 | } | 3277 | } |
3213 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3278 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3238,8 +3303,14 @@ impl AstNode for RecordFieldDefList { | |||
3238 | } | 3303 | } |
3239 | } | 3304 | } |
3240 | impl RecordFieldDefList { | 3305 | impl RecordFieldDefList { |
3306 | pub fn l_curly(&self) -> Option<LCurly> { | ||
3307 | support::token(&self.syntax) | ||
3308 | } | ||
3241 | pub fn fields(&self) -> AstChildren<RecordFieldDef> { | 3309 | pub fn fields(&self) -> AstChildren<RecordFieldDef> { |
3242 | AstChildren::new(&self.syntax) | 3310 | support::children(&self.syntax) |
3311 | } | ||
3312 | pub fn r_curly(&self) -> Option<RCurly> { | ||
3313 | support::token(&self.syntax) | ||
3243 | } | 3314 | } |
3244 | } | 3315 | } |
3245 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3316 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3303,8 +3374,14 @@ impl AstNode for TupleFieldDefList { | |||
3303 | } | 3374 | } |
3304 | } | 3375 | } |
3305 | impl TupleFieldDefList { | 3376 | impl TupleFieldDefList { |
3377 | pub fn l_paren(&self) -> Option<LParen> { | ||
3378 | support::token(&self.syntax) | ||
3379 | } | ||
3306 | pub fn fields(&self) -> AstChildren<TupleFieldDef> { | 3380 | pub fn fields(&self) -> AstChildren<TupleFieldDef> { |
3307 | AstChildren::new(&self.syntax) | 3381 | support::children(&self.syntax) |
3382 | } | ||
3383 | pub fn r_paren(&self) -> Option<RParen> { | ||
3384 | support::token(&self.syntax) | ||
3308 | } | 3385 | } |
3309 | } | 3386 | } |
3310 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3387 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3338,7 +3415,7 @@ impl ast::VisibilityOwner for TupleFieldDef {} | |||
3338 | impl ast::AttrsOwner for TupleFieldDef {} | 3415 | impl ast::AttrsOwner for TupleFieldDef {} |
3339 | impl TupleFieldDef { | 3416 | impl TupleFieldDef { |
3340 | pub fn type_ref(&self) -> Option<TypeRef> { | 3417 | pub fn type_ref(&self) -> Option<TypeRef> { |
3341 | AstChildren::new(&self.syntax).next() | 3418 | support::child(&self.syntax) |
3342 | } | 3419 | } |
3343 | } | 3420 | } |
3344 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3421 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3374,8 +3451,11 @@ impl ast::TypeParamsOwner for EnumDef {} | |||
3374 | impl ast::AttrsOwner for EnumDef {} | 3451 | impl ast::AttrsOwner for EnumDef {} |
3375 | impl ast::DocCommentsOwner for EnumDef {} | 3452 | impl ast::DocCommentsOwner for EnumDef {} |
3376 | impl EnumDef { | 3453 | impl EnumDef { |
3454 | pub fn enum_kw(&self) -> Option<EnumKw> { | ||
3455 | support::token(&self.syntax) | ||
3456 | } | ||
3377 | pub fn variant_list(&self) -> Option<EnumVariantList> { | 3457 | pub fn variant_list(&self) -> Option<EnumVariantList> { |
3378 | AstChildren::new(&self.syntax).next() | 3458 | support::child(&self.syntax) |
3379 | } | 3459 | } |
3380 | } | 3460 | } |
3381 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3461 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3406,8 +3486,14 @@ impl AstNode for EnumVariantList { | |||
3406 | } | 3486 | } |
3407 | } | 3487 | } |
3408 | impl EnumVariantList { | 3488 | impl EnumVariantList { |
3489 | pub fn l_curly(&self) -> Option<LCurly> { | ||
3490 | support::token(&self.syntax) | ||
3491 | } | ||
3409 | pub fn variants(&self) -> AstChildren<EnumVariant> { | 3492 | pub fn variants(&self) -> AstChildren<EnumVariant> { |
3410 | AstChildren::new(&self.syntax) | 3493 | support::children(&self.syntax) |
3494 | } | ||
3495 | pub fn r_curly(&self) -> Option<RCurly> { | ||
3496 | support::token(&self.syntax) | ||
3411 | } | 3497 | } |
3412 | } | 3498 | } |
3413 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3499 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3437,12 +3523,19 @@ impl AstNode for EnumVariant { | |||
3437 | &self.syntax | 3523 | &self.syntax |
3438 | } | 3524 | } |
3439 | } | 3525 | } |
3526 | impl ast::VisibilityOwner for EnumVariant {} | ||
3440 | impl ast::NameOwner for EnumVariant {} | 3527 | impl ast::NameOwner for EnumVariant {} |
3441 | impl ast::DocCommentsOwner for EnumVariant {} | 3528 | impl ast::DocCommentsOwner for EnumVariant {} |
3442 | impl ast::AttrsOwner for EnumVariant {} | 3529 | impl ast::AttrsOwner for EnumVariant {} |
3443 | impl EnumVariant { | 3530 | impl EnumVariant { |
3531 | pub fn field_def_list(&self) -> Option<FieldDefList> { | ||
3532 | support::child(&self.syntax) | ||
3533 | } | ||
3534 | pub fn eq(&self) -> Option<Eq> { | ||
3535 | support::token(&self.syntax) | ||
3536 | } | ||
3444 | pub fn expr(&self) -> Option<Expr> { | 3537 | pub fn expr(&self) -> Option<Expr> { |
3445 | AstChildren::new(&self.syntax).next() | 3538 | support::child(&self.syntax) |
3446 | } | 3539 | } |
3447 | } | 3540 | } |
3448 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3541 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3479,8 +3572,17 @@ impl ast::DocCommentsOwner for TraitDef {} | |||
3479 | impl ast::TypeParamsOwner for TraitDef {} | 3572 | impl ast::TypeParamsOwner for TraitDef {} |
3480 | impl ast::TypeBoundsOwner for TraitDef {} | 3573 | impl ast::TypeBoundsOwner for TraitDef {} |
3481 | impl TraitDef { | 3574 | impl TraitDef { |
3575 | pub fn unsafe_kw(&self) -> Option<UnsafeKw> { | ||
3576 | support::token(&self.syntax) | ||
3577 | } | ||
3578 | pub fn auto_kw(&self) -> Option<AutoKw> { | ||
3579 | support::token(&self.syntax) | ||
3580 | } | ||
3581 | pub fn trait_kw(&self) -> Option<TraitKw> { | ||
3582 | support::token(&self.syntax) | ||
3583 | } | ||
3482 | pub fn item_list(&self) -> Option<ItemList> { | 3584 | pub fn item_list(&self) -> Option<ItemList> { |
3483 | AstChildren::new(&self.syntax).next() | 3585 | support::child(&self.syntax) |
3484 | } | 3586 | } |
3485 | } | 3587 | } |
3486 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3588 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3515,8 +3617,14 @@ impl ast::NameOwner for Module {} | |||
3515 | impl ast::AttrsOwner for Module {} | 3617 | impl ast::AttrsOwner for Module {} |
3516 | impl ast::DocCommentsOwner for Module {} | 3618 | impl ast::DocCommentsOwner for Module {} |
3517 | impl Module { | 3619 | impl Module { |
3620 | pub fn mod_kw(&self) -> Option<ModKw> { | ||
3621 | support::token(&self.syntax) | ||
3622 | } | ||
3518 | pub fn item_list(&self) -> Option<ItemList> { | 3623 | pub fn item_list(&self) -> Option<ItemList> { |
3519 | AstChildren::new(&self.syntax).next() | 3624 | support::child(&self.syntax) |
3625 | } | ||
3626 | pub fn semi(&self) -> Option<Semi> { | ||
3627 | support::token(&self.syntax) | ||
3520 | } | 3628 | } |
3521 | } | 3629 | } |
3522 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3630 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3549,8 +3657,14 @@ impl AstNode for ItemList { | |||
3549 | impl ast::FnDefOwner for ItemList {} | 3657 | impl ast::FnDefOwner for ItemList {} |
3550 | impl ast::ModuleItemOwner for ItemList {} | 3658 | impl ast::ModuleItemOwner for ItemList {} |
3551 | impl ItemList { | 3659 | impl ItemList { |
3660 | pub fn l_curly(&self) -> Option<LCurly> { | ||
3661 | support::token(&self.syntax) | ||
3662 | } | ||
3552 | pub fn impl_items(&self) -> AstChildren<ImplItem> { | 3663 | pub fn impl_items(&self) -> AstChildren<ImplItem> { |
3553 | AstChildren::new(&self.syntax) | 3664 | support::children(&self.syntax) |
3665 | } | ||
3666 | pub fn r_curly(&self) -> Option<RCurly> { | ||
3667 | support::token(&self.syntax) | ||
3554 | } | 3668 | } |
3555 | } | 3669 | } |
3556 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3670 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3587,8 +3701,20 @@ impl ast::AttrsOwner for ConstDef {} | |||
3587 | impl ast::DocCommentsOwner for ConstDef {} | 3701 | impl ast::DocCommentsOwner for ConstDef {} |
3588 | impl ast::TypeAscriptionOwner for ConstDef {} | 3702 | impl ast::TypeAscriptionOwner for ConstDef {} |
3589 | impl ConstDef { | 3703 | impl ConstDef { |
3704 | pub fn default_kw(&self) -> Option<DefaultKw> { | ||
3705 | support::token(&self.syntax) | ||
3706 | } | ||
3707 | pub fn const_kw(&self) -> Option<ConstKw> { | ||
3708 | support::token(&self.syntax) | ||
3709 | } | ||
3710 | pub fn eq(&self) -> Option<Eq> { | ||
3711 | support::token(&self.syntax) | ||
3712 | } | ||
3590 | pub fn body(&self) -> Option<Expr> { | 3713 | pub fn body(&self) -> Option<Expr> { |
3591 | AstChildren::new(&self.syntax).next() | 3714 | support::child(&self.syntax) |
3715 | } | ||
3716 | pub fn semi(&self) -> Option<Semi> { | ||
3717 | support::token(&self.syntax) | ||
3592 | } | 3718 | } |
3593 | } | 3719 | } |
3594 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3720 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3625,8 +3751,20 @@ impl ast::AttrsOwner for StaticDef {} | |||
3625 | impl ast::DocCommentsOwner for StaticDef {} | 3751 | impl ast::DocCommentsOwner for StaticDef {} |
3626 | impl ast::TypeAscriptionOwner for StaticDef {} | 3752 | impl ast::TypeAscriptionOwner for StaticDef {} |
3627 | impl StaticDef { | 3753 | impl StaticDef { |
3754 | pub fn static_kw(&self) -> Option<StaticKw> { | ||
3755 | support::token(&self.syntax) | ||
3756 | } | ||
3757 | pub fn mut_kw(&self) -> Option<MutKw> { | ||
3758 | support::token(&self.syntax) | ||
3759 | } | ||
3760 | pub fn eq(&self) -> Option<Eq> { | ||
3761 | support::token(&self.syntax) | ||
3762 | } | ||
3628 | pub fn body(&self) -> Option<Expr> { | 3763 | pub fn body(&self) -> Option<Expr> { |
3629 | AstChildren::new(&self.syntax).next() | 3764 | support::child(&self.syntax) |
3765 | } | ||
3766 | pub fn semi(&self) -> Option<Semi> { | ||
3767 | support::token(&self.syntax) | ||
3630 | } | 3768 | } |
3631 | } | 3769 | } |
3632 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3770 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3663,8 +3801,20 @@ impl ast::AttrsOwner for TypeAliasDef {} | |||
3663 | impl ast::DocCommentsOwner for TypeAliasDef {} | 3801 | impl ast::DocCommentsOwner for TypeAliasDef {} |
3664 | impl ast::TypeBoundsOwner for TypeAliasDef {} | 3802 | impl ast::TypeBoundsOwner for TypeAliasDef {} |
3665 | impl TypeAliasDef { | 3803 | impl TypeAliasDef { |
3804 | pub fn default_kw(&self) -> Option<DefaultKw> { | ||
3805 | support::token(&self.syntax) | ||
3806 | } | ||
3807 | pub fn type_kw(&self) -> Option<TypeKw> { | ||
3808 | support::token(&self.syntax) | ||
3809 | } | ||
3810 | pub fn eq(&self) -> Option<Eq> { | ||
3811 | support::token(&self.syntax) | ||
3812 | } | ||
3666 | pub fn type_ref(&self) -> Option<TypeRef> { | 3813 | pub fn type_ref(&self) -> Option<TypeRef> { |
3667 | AstChildren::new(&self.syntax).next() | 3814 | support::child(&self.syntax) |
3815 | } | ||
3816 | pub fn semi(&self) -> Option<Semi> { | ||
3817 | support::token(&self.syntax) | ||
3668 | } | 3818 | } |
3669 | } | 3819 | } |
3670 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3820 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3697,8 +3847,26 @@ impl AstNode for ImplDef { | |||
3697 | impl ast::TypeParamsOwner for ImplDef {} | 3847 | impl ast::TypeParamsOwner for ImplDef {} |
3698 | impl ast::AttrsOwner for ImplDef {} | 3848 | impl ast::AttrsOwner for ImplDef {} |
3699 | impl ImplDef { | 3849 | impl ImplDef { |
3850 | pub fn default_kw(&self) -> Option<DefaultKw> { | ||
3851 | support::token(&self.syntax) | ||
3852 | } | ||
3853 | pub fn const_kw(&self) -> Option<ConstKw> { | ||
3854 | support::token(&self.syntax) | ||
3855 | } | ||
3856 | pub fn unsafe_kw(&self) -> Option<UnsafeKw> { | ||
3857 | support::token(&self.syntax) | ||
3858 | } | ||
3859 | pub fn impl_kw(&self) -> Option<ImplKw> { | ||
3860 | support::token(&self.syntax) | ||
3861 | } | ||
3862 | pub fn excl(&self) -> Option<Excl> { | ||
3863 | support::token(&self.syntax) | ||
3864 | } | ||
3865 | pub fn for_kw(&self) -> Option<ForKw> { | ||
3866 | support::token(&self.syntax) | ||
3867 | } | ||
3700 | pub fn item_list(&self) -> Option<ItemList> { | 3868 | pub fn item_list(&self) -> Option<ItemList> { |
3701 | AstChildren::new(&self.syntax).next() | 3869 | support::child(&self.syntax) |
3702 | } | 3870 | } |
3703 | } | 3871 | } |
3704 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3872 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3729,8 +3897,14 @@ impl AstNode for ParenType { | |||
3729 | } | 3897 | } |
3730 | } | 3898 | } |
3731 | impl ParenType { | 3899 | impl ParenType { |
3900 | pub fn l_paren(&self) -> Option<LParen> { | ||
3901 | support::token(&self.syntax) | ||
3902 | } | ||
3732 | pub fn type_ref(&self) -> Option<TypeRef> { | 3903 | pub fn type_ref(&self) -> Option<TypeRef> { |
3733 | AstChildren::new(&self.syntax).next() | 3904 | support::child(&self.syntax) |
3905 | } | ||
3906 | pub fn r_paren(&self) -> Option<RParen> { | ||
3907 | support::token(&self.syntax) | ||
3734 | } | 3908 | } |
3735 | } | 3909 | } |
3736 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3910 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3761,8 +3935,14 @@ impl AstNode for TupleType { | |||
3761 | } | 3935 | } |
3762 | } | 3936 | } |
3763 | impl TupleType { | 3937 | impl TupleType { |
3938 | pub fn l_paren(&self) -> Option<LParen> { | ||
3939 | support::token(&self.syntax) | ||
3940 | } | ||
3764 | pub fn fields(&self) -> AstChildren<TypeRef> { | 3941 | pub fn fields(&self) -> AstChildren<TypeRef> { |
3765 | AstChildren::new(&self.syntax) | 3942 | support::children(&self.syntax) |
3943 | } | ||
3944 | pub fn r_paren(&self) -> Option<RParen> { | ||
3945 | support::token(&self.syntax) | ||
3766 | } | 3946 | } |
3767 | } | 3947 | } |
3768 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3948 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3792,7 +3972,11 @@ impl AstNode for NeverType { | |||
3792 | &self.syntax | 3972 | &self.syntax |
3793 | } | 3973 | } |
3794 | } | 3974 | } |
3795 | impl NeverType {} | 3975 | impl NeverType { |
3976 | pub fn excl(&self) -> Option<Excl> { | ||
3977 | support::token(&self.syntax) | ||
3978 | } | ||
3979 | } | ||
3796 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 3980 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3797 | pub struct PathType { | 3981 | pub struct PathType { |
3798 | pub(crate) syntax: SyntaxNode, | 3982 | pub(crate) syntax: SyntaxNode, |
@@ -3822,7 +4006,7 @@ impl AstNode for PathType { | |||
3822 | } | 4006 | } |
3823 | impl PathType { | 4007 | impl PathType { |
3824 | pub fn path(&self) -> Option<Path> { | 4008 | pub fn path(&self) -> Option<Path> { |
3825 | AstChildren::new(&self.syntax).next() | 4009 | support::child(&self.syntax) |
3826 | } | 4010 | } |
3827 | } | 4011 | } |
3828 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4012 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3853,8 +4037,14 @@ impl AstNode for PointerType { | |||
3853 | } | 4037 | } |
3854 | } | 4038 | } |
3855 | impl PointerType { | 4039 | impl PointerType { |
4040 | pub fn star(&self) -> Option<Star> { | ||
4041 | support::token(&self.syntax) | ||
4042 | } | ||
4043 | pub fn const_kw(&self) -> Option<ConstKw> { | ||
4044 | support::token(&self.syntax) | ||
4045 | } | ||
3856 | pub fn type_ref(&self) -> Option<TypeRef> { | 4046 | pub fn type_ref(&self) -> Option<TypeRef> { |
3857 | AstChildren::new(&self.syntax).next() | 4047 | support::child(&self.syntax) |
3858 | } | 4048 | } |
3859 | } | 4049 | } |
3860 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4050 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3885,11 +4075,20 @@ impl AstNode for ArrayType { | |||
3885 | } | 4075 | } |
3886 | } | 4076 | } |
3887 | impl ArrayType { | 4077 | impl ArrayType { |
4078 | pub fn l_brack(&self) -> Option<LBrack> { | ||
4079 | support::token(&self.syntax) | ||
4080 | } | ||
3888 | pub fn type_ref(&self) -> Option<TypeRef> { | 4081 | pub fn type_ref(&self) -> Option<TypeRef> { |
3889 | AstChildren::new(&self.syntax).next() | 4082 | support::child(&self.syntax) |
4083 | } | ||
4084 | pub fn semi(&self) -> Option<Semi> { | ||
4085 | support::token(&self.syntax) | ||
3890 | } | 4086 | } |
3891 | pub fn expr(&self) -> Option<Expr> { | 4087 | pub fn expr(&self) -> Option<Expr> { |
3892 | AstChildren::new(&self.syntax).next() | 4088 | support::child(&self.syntax) |
4089 | } | ||
4090 | pub fn r_brack(&self) -> Option<RBrack> { | ||
4091 | support::token(&self.syntax) | ||
3893 | } | 4092 | } |
3894 | } | 4093 | } |
3895 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4094 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3920,8 +4119,14 @@ impl AstNode for SliceType { | |||
3920 | } | 4119 | } |
3921 | } | 4120 | } |
3922 | impl SliceType { | 4121 | impl SliceType { |
4122 | pub fn l_brack(&self) -> Option<LBrack> { | ||
4123 | support::token(&self.syntax) | ||
4124 | } | ||
3923 | pub fn type_ref(&self) -> Option<TypeRef> { | 4125 | pub fn type_ref(&self) -> Option<TypeRef> { |
3924 | AstChildren::new(&self.syntax).next() | 4126 | support::child(&self.syntax) |
4127 | } | ||
4128 | pub fn r_brack(&self) -> Option<RBrack> { | ||
4129 | support::token(&self.syntax) | ||
3925 | } | 4130 | } |
3926 | } | 4131 | } |
3927 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4132 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3952,8 +4157,17 @@ impl AstNode for ReferenceType { | |||
3952 | } | 4157 | } |
3953 | } | 4158 | } |
3954 | impl ReferenceType { | 4159 | impl ReferenceType { |
4160 | pub fn amp(&self) -> Option<Amp> { | ||
4161 | support::token(&self.syntax) | ||
4162 | } | ||
4163 | pub fn lifetime(&self) -> Option<Lifetime> { | ||
4164 | support::token(&self.syntax) | ||
4165 | } | ||
4166 | pub fn mut_kw(&self) -> Option<MutKw> { | ||
4167 | support::token(&self.syntax) | ||
4168 | } | ||
3955 | pub fn type_ref(&self) -> Option<TypeRef> { | 4169 | pub fn type_ref(&self) -> Option<TypeRef> { |
3956 | AstChildren::new(&self.syntax).next() | 4170 | support::child(&self.syntax) |
3957 | } | 4171 | } |
3958 | } | 4172 | } |
3959 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4173 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -3983,7 +4197,11 @@ impl AstNode for PlaceholderType { | |||
3983 | &self.syntax | 4197 | &self.syntax |
3984 | } | 4198 | } |
3985 | } | 4199 | } |
3986 | impl PlaceholderType {} | 4200 | impl PlaceholderType { |
4201 | pub fn underscore(&self) -> Option<Underscore> { | ||
4202 | support::token(&self.syntax) | ||
4203 | } | ||
4204 | } | ||
3987 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4205 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
3988 | pub struct FnPointerType { | 4206 | pub struct FnPointerType { |
3989 | pub(crate) syntax: SyntaxNode, | 4207 | pub(crate) syntax: SyntaxNode, |
@@ -4012,11 +4230,20 @@ impl AstNode for FnPointerType { | |||
4012 | } | 4230 | } |
4013 | } | 4231 | } |
4014 | impl FnPointerType { | 4232 | impl FnPointerType { |
4233 | pub fn abi(&self) -> Option<Abi> { | ||
4234 | support::child(&self.syntax) | ||
4235 | } | ||
4236 | pub fn unsafe_kw(&self) -> Option<UnsafeKw> { | ||
4237 | support::token(&self.syntax) | ||
4238 | } | ||
4239 | pub fn fn_kw(&self) -> Option<FnKw> { | ||
4240 | support::token(&self.syntax) | ||
4241 | } | ||
4015 | pub fn param_list(&self) -> Option<ParamList> { | 4242 | pub fn param_list(&self) -> Option<ParamList> { |
4016 | AstChildren::new(&self.syntax).next() | 4243 | support::child(&self.syntax) |
4017 | } | 4244 | } |
4018 | pub fn ret_type(&self) -> Option<RetType> { | 4245 | pub fn ret_type(&self) -> Option<RetType> { |
4019 | AstChildren::new(&self.syntax).next() | 4246 | support::child(&self.syntax) |
4020 | } | 4247 | } |
4021 | } | 4248 | } |
4022 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4249 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4047,8 +4274,14 @@ impl AstNode for ForType { | |||
4047 | } | 4274 | } |
4048 | } | 4275 | } |
4049 | impl ForType { | 4276 | impl ForType { |
4277 | pub fn for_kw(&self) -> Option<ForKw> { | ||
4278 | support::token(&self.syntax) | ||
4279 | } | ||
4280 | pub fn type_param_list(&self) -> Option<TypeParamList> { | ||
4281 | support::child(&self.syntax) | ||
4282 | } | ||
4050 | pub fn type_ref(&self) -> Option<TypeRef> { | 4283 | pub fn type_ref(&self) -> Option<TypeRef> { |
4051 | AstChildren::new(&self.syntax).next() | 4284 | support::child(&self.syntax) |
4052 | } | 4285 | } |
4053 | } | 4286 | } |
4054 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4287 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4079,7 +4312,11 @@ impl AstNode for ImplTraitType { | |||
4079 | } | 4312 | } |
4080 | } | 4313 | } |
4081 | impl ast::TypeBoundsOwner for ImplTraitType {} | 4314 | impl ast::TypeBoundsOwner for ImplTraitType {} |
4082 | impl ImplTraitType {} | 4315 | impl ImplTraitType { |
4316 | pub fn impl_kw(&self) -> Option<ImplKw> { | ||
4317 | support::token(&self.syntax) | ||
4318 | } | ||
4319 | } | ||
4083 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4320 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
4084 | pub struct DynTraitType { | 4321 | pub struct DynTraitType { |
4085 | pub(crate) syntax: SyntaxNode, | 4322 | pub(crate) syntax: SyntaxNode, |
@@ -4108,7 +4345,11 @@ impl AstNode for DynTraitType { | |||
4108 | } | 4345 | } |
4109 | } | 4346 | } |
4110 | impl ast::TypeBoundsOwner for DynTraitType {} | 4347 | impl ast::TypeBoundsOwner for DynTraitType {} |
4111 | impl DynTraitType {} | 4348 | impl DynTraitType { |
4349 | pub fn dyn_kw(&self) -> Option<DynKw> { | ||
4350 | support::token(&self.syntax) | ||
4351 | } | ||
4352 | } | ||
4112 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4353 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
4113 | pub struct TupleExpr { | 4354 | pub struct TupleExpr { |
4114 | pub(crate) syntax: SyntaxNode, | 4355 | pub(crate) syntax: SyntaxNode, |
@@ -4136,9 +4377,16 @@ impl AstNode for TupleExpr { | |||
4136 | &self.syntax | 4377 | &self.syntax |
4137 | } | 4378 | } |
4138 | } | 4379 | } |
4380 | impl ast::AttrsOwner for TupleExpr {} | ||
4139 | impl TupleExpr { | 4381 | impl TupleExpr { |
4382 | pub fn l_paren(&self) -> Option<LParen> { | ||
4383 | support::token(&self.syntax) | ||
4384 | } | ||
4140 | pub fn exprs(&self) -> AstChildren<Expr> { | 4385 | pub fn exprs(&self) -> AstChildren<Expr> { |
4141 | AstChildren::new(&self.syntax) | 4386 | support::children(&self.syntax) |
4387 | } | ||
4388 | pub fn r_paren(&self) -> Option<RParen> { | ||
4389 | support::token(&self.syntax) | ||
4142 | } | 4390 | } |
4143 | } | 4391 | } |
4144 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4392 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4168,9 +4416,19 @@ impl AstNode for ArrayExpr { | |||
4168 | &self.syntax | 4416 | &self.syntax |
4169 | } | 4417 | } |
4170 | } | 4418 | } |
4419 | impl ast::AttrsOwner for ArrayExpr {} | ||
4171 | impl ArrayExpr { | 4420 | impl ArrayExpr { |
4421 | pub fn l_brack(&self) -> Option<LBrack> { | ||
4422 | support::token(&self.syntax) | ||
4423 | } | ||
4172 | pub fn exprs(&self) -> AstChildren<Expr> { | 4424 | pub fn exprs(&self) -> AstChildren<Expr> { |
4173 | AstChildren::new(&self.syntax) | 4425 | support::children(&self.syntax) |
4426 | } | ||
4427 | pub fn semi(&self) -> Option<Semi> { | ||
4428 | support::token(&self.syntax) | ||
4429 | } | ||
4430 | pub fn r_brack(&self) -> Option<RBrack> { | ||
4431 | support::token(&self.syntax) | ||
4174 | } | 4432 | } |
4175 | } | 4433 | } |
4176 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4434 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4200,9 +4458,16 @@ impl AstNode for ParenExpr { | |||
4200 | &self.syntax | 4458 | &self.syntax |
4201 | } | 4459 | } |
4202 | } | 4460 | } |
4461 | impl ast::AttrsOwner for ParenExpr {} | ||
4203 | impl ParenExpr { | 4462 | impl ParenExpr { |
4463 | pub fn l_paren(&self) -> Option<LParen> { | ||
4464 | support::token(&self.syntax) | ||
4465 | } | ||
4204 | pub fn expr(&self) -> Option<Expr> { | 4466 | pub fn expr(&self) -> Option<Expr> { |
4205 | AstChildren::new(&self.syntax).next() | 4467 | support::child(&self.syntax) |
4468 | } | ||
4469 | pub fn r_paren(&self) -> Option<RParen> { | ||
4470 | support::token(&self.syntax) | ||
4206 | } | 4471 | } |
4207 | } | 4472 | } |
4208 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4473 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4234,7 +4499,7 @@ impl AstNode for PathExpr { | |||
4234 | } | 4499 | } |
4235 | impl PathExpr { | 4500 | impl PathExpr { |
4236 | pub fn path(&self) -> Option<Path> { | 4501 | pub fn path(&self) -> Option<Path> { |
4237 | AstChildren::new(&self.syntax).next() | 4502 | support::child(&self.syntax) |
4238 | } | 4503 | } |
4239 | } | 4504 | } |
4240 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4505 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4264,15 +4529,25 @@ impl AstNode for LambdaExpr { | |||
4264 | &self.syntax | 4529 | &self.syntax |
4265 | } | 4530 | } |
4266 | } | 4531 | } |
4532 | impl ast::AttrsOwner for LambdaExpr {} | ||
4267 | impl LambdaExpr { | 4533 | impl LambdaExpr { |
4534 | pub fn static_kw(&self) -> Option<StaticKw> { | ||
4535 | support::token(&self.syntax) | ||
4536 | } | ||
4537 | pub fn async_kw(&self) -> Option<AsyncKw> { | ||
4538 | support::token(&self.syntax) | ||
4539 | } | ||
4540 | pub fn move_kw(&self) -> Option<MoveKw> { | ||
4541 | support::token(&self.syntax) | ||
4542 | } | ||
4268 | pub fn param_list(&self) -> Option<ParamList> { | 4543 | pub fn param_list(&self) -> Option<ParamList> { |
4269 | AstChildren::new(&self.syntax).next() | 4544 | support::child(&self.syntax) |
4270 | } | 4545 | } |
4271 | pub fn ret_type(&self) -> Option<RetType> { | 4546 | pub fn ret_type(&self) -> Option<RetType> { |
4272 | AstChildren::new(&self.syntax).next() | 4547 | support::child(&self.syntax) |
4273 | } | 4548 | } |
4274 | pub fn body(&self) -> Option<Expr> { | 4549 | pub fn body(&self) -> Option<Expr> { |
4275 | AstChildren::new(&self.syntax).next() | 4550 | support::child(&self.syntax) |
4276 | } | 4551 | } |
4277 | } | 4552 | } |
4278 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4553 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4302,9 +4577,13 @@ impl AstNode for IfExpr { | |||
4302 | &self.syntax | 4577 | &self.syntax |
4303 | } | 4578 | } |
4304 | } | 4579 | } |
4580 | impl ast::AttrsOwner for IfExpr {} | ||
4305 | impl IfExpr { | 4581 | impl IfExpr { |
4582 | pub fn if_kw(&self) -> Option<IfKw> { | ||
4583 | support::token(&self.syntax) | ||
4584 | } | ||
4306 | pub fn condition(&self) -> Option<Condition> { | 4585 | pub fn condition(&self) -> Option<Condition> { |
4307 | AstChildren::new(&self.syntax).next() | 4586 | support::child(&self.syntax) |
4308 | } | 4587 | } |
4309 | } | 4588 | } |
4310 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4589 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4334,8 +4613,13 @@ impl AstNode for LoopExpr { | |||
4334 | &self.syntax | 4613 | &self.syntax |
4335 | } | 4614 | } |
4336 | } | 4615 | } |
4616 | impl ast::AttrsOwner for LoopExpr {} | ||
4337 | impl ast::LoopBodyOwner for LoopExpr {} | 4617 | impl ast::LoopBodyOwner for LoopExpr {} |
4338 | impl LoopExpr {} | 4618 | impl LoopExpr { |
4619 | pub fn loop_kw(&self) -> Option<LoopKw> { | ||
4620 | support::token(&self.syntax) | ||
4621 | } | ||
4622 | } | ||
4339 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4623 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
4340 | pub struct TryBlockExpr { | 4624 | pub struct TryBlockExpr { |
4341 | pub(crate) syntax: SyntaxNode, | 4625 | pub(crate) syntax: SyntaxNode, |
@@ -4363,9 +4647,13 @@ impl AstNode for TryBlockExpr { | |||
4363 | &self.syntax | 4647 | &self.syntax |
4364 | } | 4648 | } |
4365 | } | 4649 | } |
4650 | impl ast::AttrsOwner for TryBlockExpr {} | ||
4366 | impl TryBlockExpr { | 4651 | impl TryBlockExpr { |
4652 | pub fn try_kw(&self) -> Option<TryKw> { | ||
4653 | support::token(&self.syntax) | ||
4654 | } | ||
4367 | pub fn body(&self) -> Option<BlockExpr> { | 4655 | pub fn body(&self) -> Option<BlockExpr> { |
4368 | AstChildren::new(&self.syntax).next() | 4656 | support::child(&self.syntax) |
4369 | } | 4657 | } |
4370 | } | 4658 | } |
4371 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4659 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4395,13 +4683,20 @@ impl AstNode for ForExpr { | |||
4395 | &self.syntax | 4683 | &self.syntax |
4396 | } | 4684 | } |
4397 | } | 4685 | } |
4686 | impl ast::AttrsOwner for ForExpr {} | ||
4398 | impl ast::LoopBodyOwner for ForExpr {} | 4687 | impl ast::LoopBodyOwner for ForExpr {} |
4399 | impl ForExpr { | 4688 | impl ForExpr { |
4689 | pub fn for_kw(&self) -> Option<ForKw> { | ||
4690 | support::token(&self.syntax) | ||
4691 | } | ||
4400 | pub fn pat(&self) -> Option<Pat> { | 4692 | pub fn pat(&self) -> Option<Pat> { |
4401 | AstChildren::new(&self.syntax).next() | 4693 | support::child(&self.syntax) |
4694 | } | ||
4695 | pub fn in_kw(&self) -> Option<InKw> { | ||
4696 | support::token(&self.syntax) | ||
4402 | } | 4697 | } |
4403 | pub fn iterable(&self) -> Option<Expr> { | 4698 | pub fn iterable(&self) -> Option<Expr> { |
4404 | AstChildren::new(&self.syntax).next() | 4699 | support::child(&self.syntax) |
4405 | } | 4700 | } |
4406 | } | 4701 | } |
4407 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4702 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4431,10 +4726,14 @@ impl AstNode for WhileExpr { | |||
4431 | &self.syntax | 4726 | &self.syntax |
4432 | } | 4727 | } |
4433 | } | 4728 | } |
4729 | impl ast::AttrsOwner for WhileExpr {} | ||
4434 | impl ast::LoopBodyOwner for WhileExpr {} | 4730 | impl ast::LoopBodyOwner for WhileExpr {} |
4435 | impl WhileExpr { | 4731 | impl WhileExpr { |
4732 | pub fn while_kw(&self) -> Option<WhileKw> { | ||
4733 | support::token(&self.syntax) | ||
4734 | } | ||
4436 | pub fn condition(&self) -> Option<Condition> { | 4735 | pub fn condition(&self) -> Option<Condition> { |
4437 | AstChildren::new(&self.syntax).next() | 4736 | support::child(&self.syntax) |
4438 | } | 4737 | } |
4439 | } | 4738 | } |
4440 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4739 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4464,7 +4763,15 @@ impl AstNode for ContinueExpr { | |||
4464 | &self.syntax | 4763 | &self.syntax |
4465 | } | 4764 | } |
4466 | } | 4765 | } |
4467 | impl ContinueExpr {} | 4766 | impl ast::AttrsOwner for ContinueExpr {} |
4767 | impl ContinueExpr { | ||
4768 | pub fn continue_kw(&self) -> Option<ContinueKw> { | ||
4769 | support::token(&self.syntax) | ||
4770 | } | ||
4771 | pub fn lifetime(&self) -> Option<Lifetime> { | ||
4772 | support::token(&self.syntax) | ||
4773 | } | ||
4774 | } | ||
4468 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4775 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
4469 | pub struct BreakExpr { | 4776 | pub struct BreakExpr { |
4470 | pub(crate) syntax: SyntaxNode, | 4777 | pub(crate) syntax: SyntaxNode, |
@@ -4492,9 +4799,16 @@ impl AstNode for BreakExpr { | |||
4492 | &self.syntax | 4799 | &self.syntax |
4493 | } | 4800 | } |
4494 | } | 4801 | } |
4802 | impl ast::AttrsOwner for BreakExpr {} | ||
4495 | impl BreakExpr { | 4803 | impl BreakExpr { |
4804 | pub fn break_kw(&self) -> Option<BreakKw> { | ||
4805 | support::token(&self.syntax) | ||
4806 | } | ||
4807 | pub fn lifetime(&self) -> Option<Lifetime> { | ||
4808 | support::token(&self.syntax) | ||
4809 | } | ||
4496 | pub fn expr(&self) -> Option<Expr> { | 4810 | pub fn expr(&self) -> Option<Expr> { |
4497 | AstChildren::new(&self.syntax).next() | 4811 | support::child(&self.syntax) |
4498 | } | 4812 | } |
4499 | } | 4813 | } |
4500 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4814 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4524,7 +4838,11 @@ impl AstNode for Label { | |||
4524 | &self.syntax | 4838 | &self.syntax |
4525 | } | 4839 | } |
4526 | } | 4840 | } |
4527 | impl Label {} | 4841 | impl Label { |
4842 | pub fn lifetime(&self) -> Option<Lifetime> { | ||
4843 | support::token(&self.syntax) | ||
4844 | } | ||
4845 | } | ||
4528 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4846 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
4529 | pub struct BlockExpr { | 4847 | pub struct BlockExpr { |
4530 | pub(crate) syntax: SyntaxNode, | 4848 | pub(crate) syntax: SyntaxNode, |
@@ -4552,9 +4870,16 @@ impl AstNode for BlockExpr { | |||
4552 | &self.syntax | 4870 | &self.syntax |
4553 | } | 4871 | } |
4554 | } | 4872 | } |
4873 | impl ast::AttrsOwner for BlockExpr {} | ||
4555 | impl BlockExpr { | 4874 | impl BlockExpr { |
4875 | pub fn label(&self) -> Option<Label> { | ||
4876 | support::child(&self.syntax) | ||
4877 | } | ||
4878 | pub fn unsafe_kw(&self) -> Option<UnsafeKw> { | ||
4879 | support::token(&self.syntax) | ||
4880 | } | ||
4556 | pub fn block(&self) -> Option<Block> { | 4881 | pub fn block(&self) -> Option<Block> { |
4557 | AstChildren::new(&self.syntax).next() | 4882 | support::child(&self.syntax) |
4558 | } | 4883 | } |
4559 | } | 4884 | } |
4560 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4885 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4584,9 +4909,10 @@ impl AstNode for ReturnExpr { | |||
4584 | &self.syntax | 4909 | &self.syntax |
4585 | } | 4910 | } |
4586 | } | 4911 | } |
4912 | impl ast::AttrsOwner for ReturnExpr {} | ||
4587 | impl ReturnExpr { | 4913 | impl ReturnExpr { |
4588 | pub fn expr(&self) -> Option<Expr> { | 4914 | pub fn expr(&self) -> Option<Expr> { |
4589 | AstChildren::new(&self.syntax).next() | 4915 | support::child(&self.syntax) |
4590 | } | 4916 | } |
4591 | } | 4917 | } |
4592 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4918 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4619,7 +4945,7 @@ impl AstNode for CallExpr { | |||
4619 | impl ast::ArgListOwner for CallExpr {} | 4945 | impl ast::ArgListOwner for CallExpr {} |
4620 | impl CallExpr { | 4946 | impl CallExpr { |
4621 | pub fn expr(&self) -> Option<Expr> { | 4947 | pub fn expr(&self) -> Option<Expr> { |
4622 | AstChildren::new(&self.syntax).next() | 4948 | support::child(&self.syntax) |
4623 | } | 4949 | } |
4624 | } | 4950 | } |
4625 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4951 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4649,16 +4975,20 @@ impl AstNode for MethodCallExpr { | |||
4649 | &self.syntax | 4975 | &self.syntax |
4650 | } | 4976 | } |
4651 | } | 4977 | } |
4978 | impl ast::AttrsOwner for MethodCallExpr {} | ||
4652 | impl ast::ArgListOwner for MethodCallExpr {} | 4979 | impl ast::ArgListOwner for MethodCallExpr {} |
4653 | impl MethodCallExpr { | 4980 | impl MethodCallExpr { |
4654 | pub fn expr(&self) -> Option<Expr> { | 4981 | pub fn expr(&self) -> Option<Expr> { |
4655 | AstChildren::new(&self.syntax).next() | 4982 | support::child(&self.syntax) |
4983 | } | ||
4984 | pub fn dot(&self) -> Option<Dot> { | ||
4985 | support::token(&self.syntax) | ||
4656 | } | 4986 | } |
4657 | pub fn name_ref(&self) -> Option<NameRef> { | 4987 | pub fn name_ref(&self) -> Option<NameRef> { |
4658 | AstChildren::new(&self.syntax).next() | 4988 | support::child(&self.syntax) |
4659 | } | 4989 | } |
4660 | pub fn type_arg_list(&self) -> Option<TypeArgList> { | 4990 | pub fn type_arg_list(&self) -> Option<TypeArgList> { |
4661 | AstChildren::new(&self.syntax).next() | 4991 | support::child(&self.syntax) |
4662 | } | 4992 | } |
4663 | } | 4993 | } |
4664 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 4994 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4688,7 +5018,15 @@ impl AstNode for IndexExpr { | |||
4688 | &self.syntax | 5018 | &self.syntax |
4689 | } | 5019 | } |
4690 | } | 5020 | } |
4691 | impl IndexExpr {} | 5021 | impl ast::AttrsOwner for IndexExpr {} |
5022 | impl IndexExpr { | ||
5023 | pub fn l_brack(&self) -> Option<LBrack> { | ||
5024 | support::token(&self.syntax) | ||
5025 | } | ||
5026 | pub fn r_brack(&self) -> Option<RBrack> { | ||
5027 | support::token(&self.syntax) | ||
5028 | } | ||
5029 | } | ||
4692 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5030 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
4693 | pub struct FieldExpr { | 5031 | pub struct FieldExpr { |
4694 | pub(crate) syntax: SyntaxNode, | 5032 | pub(crate) syntax: SyntaxNode, |
@@ -4716,12 +5054,16 @@ impl AstNode for FieldExpr { | |||
4716 | &self.syntax | 5054 | &self.syntax |
4717 | } | 5055 | } |
4718 | } | 5056 | } |
5057 | impl ast::AttrsOwner for FieldExpr {} | ||
4719 | impl FieldExpr { | 5058 | impl FieldExpr { |
4720 | pub fn expr(&self) -> Option<Expr> { | 5059 | pub fn expr(&self) -> Option<Expr> { |
4721 | AstChildren::new(&self.syntax).next() | 5060 | support::child(&self.syntax) |
5061 | } | ||
5062 | pub fn dot(&self) -> Option<Dot> { | ||
5063 | support::token(&self.syntax) | ||
4722 | } | 5064 | } |
4723 | pub fn name_ref(&self) -> Option<NameRef> { | 5065 | pub fn name_ref(&self) -> Option<NameRef> { |
4724 | AstChildren::new(&self.syntax).next() | 5066 | support::child(&self.syntax) |
4725 | } | 5067 | } |
4726 | } | 5068 | } |
4727 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5069 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4751,9 +5093,16 @@ impl AstNode for AwaitExpr { | |||
4751 | &self.syntax | 5093 | &self.syntax |
4752 | } | 5094 | } |
4753 | } | 5095 | } |
5096 | impl ast::AttrsOwner for AwaitExpr {} | ||
4754 | impl AwaitExpr { | 5097 | impl AwaitExpr { |
4755 | pub fn expr(&self) -> Option<Expr> { | 5098 | pub fn expr(&self) -> Option<Expr> { |
4756 | AstChildren::new(&self.syntax).next() | 5099 | support::child(&self.syntax) |
5100 | } | ||
5101 | pub fn dot(&self) -> Option<Dot> { | ||
5102 | support::token(&self.syntax) | ||
5103 | } | ||
5104 | pub fn await_kw(&self) -> Option<AwaitKw> { | ||
5105 | support::token(&self.syntax) | ||
4757 | } | 5106 | } |
4758 | } | 5107 | } |
4759 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5108 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4783,9 +5132,13 @@ impl AstNode for TryExpr { | |||
4783 | &self.syntax | 5132 | &self.syntax |
4784 | } | 5133 | } |
4785 | } | 5134 | } |
5135 | impl ast::AttrsOwner for TryExpr {} | ||
4786 | impl TryExpr { | 5136 | impl TryExpr { |
5137 | pub fn try_kw(&self) -> Option<TryKw> { | ||
5138 | support::token(&self.syntax) | ||
5139 | } | ||
4787 | pub fn expr(&self) -> Option<Expr> { | 5140 | pub fn expr(&self) -> Option<Expr> { |
4788 | AstChildren::new(&self.syntax).next() | 5141 | support::child(&self.syntax) |
4789 | } | 5142 | } |
4790 | } | 5143 | } |
4791 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5144 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4815,12 +5168,16 @@ impl AstNode for CastExpr { | |||
4815 | &self.syntax | 5168 | &self.syntax |
4816 | } | 5169 | } |
4817 | } | 5170 | } |
5171 | impl ast::AttrsOwner for CastExpr {} | ||
4818 | impl CastExpr { | 5172 | impl CastExpr { |
4819 | pub fn expr(&self) -> Option<Expr> { | 5173 | pub fn expr(&self) -> Option<Expr> { |
4820 | AstChildren::new(&self.syntax).next() | 5174 | support::child(&self.syntax) |
5175 | } | ||
5176 | pub fn as_kw(&self) -> Option<AsKw> { | ||
5177 | support::token(&self.syntax) | ||
4821 | } | 5178 | } |
4822 | pub fn type_ref(&self) -> Option<TypeRef> { | 5179 | pub fn type_ref(&self) -> Option<TypeRef> { |
4823 | AstChildren::new(&self.syntax).next() | 5180 | support::child(&self.syntax) |
4824 | } | 5181 | } |
4825 | } | 5182 | } |
4826 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5183 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4850,9 +5207,19 @@ impl AstNode for RefExpr { | |||
4850 | &self.syntax | 5207 | &self.syntax |
4851 | } | 5208 | } |
4852 | } | 5209 | } |
5210 | impl ast::AttrsOwner for RefExpr {} | ||
4853 | impl RefExpr { | 5211 | impl RefExpr { |
5212 | pub fn amp(&self) -> Option<Amp> { | ||
5213 | support::token(&self.syntax) | ||
5214 | } | ||
5215 | pub fn raw_kw(&self) -> Option<RawKw> { | ||
5216 | support::token(&self.syntax) | ||
5217 | } | ||
5218 | pub fn mut_kw(&self) -> Option<MutKw> { | ||
5219 | support::token(&self.syntax) | ||
5220 | } | ||
4854 | pub fn expr(&self) -> Option<Expr> { | 5221 | pub fn expr(&self) -> Option<Expr> { |
4855 | AstChildren::new(&self.syntax).next() | 5222 | support::child(&self.syntax) |
4856 | } | 5223 | } |
4857 | } | 5224 | } |
4858 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5225 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4882,9 +5249,13 @@ impl AstNode for PrefixExpr { | |||
4882 | &self.syntax | 5249 | &self.syntax |
4883 | } | 5250 | } |
4884 | } | 5251 | } |
5252 | impl ast::AttrsOwner for PrefixExpr {} | ||
4885 | impl PrefixExpr { | 5253 | impl PrefixExpr { |
5254 | pub fn prefix_op(&self) -> Option<PrefixOp> { | ||
5255 | support::token(&self.syntax) | ||
5256 | } | ||
4886 | pub fn expr(&self) -> Option<Expr> { | 5257 | pub fn expr(&self) -> Option<Expr> { |
4887 | AstChildren::new(&self.syntax).next() | 5258 | support::child(&self.syntax) |
4888 | } | 5259 | } |
4889 | } | 5260 | } |
4890 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5261 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4914,9 +5285,13 @@ impl AstNode for BoxExpr { | |||
4914 | &self.syntax | 5285 | &self.syntax |
4915 | } | 5286 | } |
4916 | } | 5287 | } |
5288 | impl ast::AttrsOwner for BoxExpr {} | ||
4917 | impl BoxExpr { | 5289 | impl BoxExpr { |
5290 | pub fn box_kw(&self) -> Option<BoxKw> { | ||
5291 | support::token(&self.syntax) | ||
5292 | } | ||
4918 | pub fn expr(&self) -> Option<Expr> { | 5293 | pub fn expr(&self) -> Option<Expr> { |
4919 | AstChildren::new(&self.syntax).next() | 5294 | support::child(&self.syntax) |
4920 | } | 5295 | } |
4921 | } | 5296 | } |
4922 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5297 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -4946,7 +5321,12 @@ impl AstNode for RangeExpr { | |||
4946 | &self.syntax | 5321 | &self.syntax |
4947 | } | 5322 | } |
4948 | } | 5323 | } |
4949 | impl RangeExpr {} | 5324 | impl ast::AttrsOwner for RangeExpr {} |
5325 | impl RangeExpr { | ||
5326 | pub fn range_op(&self) -> Option<RangeOp> { | ||
5327 | support::token(&self.syntax) | ||
5328 | } | ||
5329 | } | ||
4950 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5330 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
4951 | pub struct BinExpr { | 5331 | pub struct BinExpr { |
4952 | pub(crate) syntax: SyntaxNode, | 5332 | pub(crate) syntax: SyntaxNode, |
@@ -4974,7 +5354,12 @@ impl AstNode for BinExpr { | |||
4974 | &self.syntax | 5354 | &self.syntax |
4975 | } | 5355 | } |
4976 | } | 5356 | } |
4977 | impl BinExpr {} | 5357 | impl ast::AttrsOwner for BinExpr {} |
5358 | impl BinExpr { | ||
5359 | pub fn bin_op(&self) -> Option<BinOp> { | ||
5360 | support::token(&self.syntax) | ||
5361 | } | ||
5362 | } | ||
4978 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5363 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
4979 | pub struct Literal { | 5364 | pub struct Literal { |
4980 | pub(crate) syntax: SyntaxNode, | 5365 | pub(crate) syntax: SyntaxNode, |
@@ -5002,7 +5387,11 @@ impl AstNode for Literal { | |||
5002 | &self.syntax | 5387 | &self.syntax |
5003 | } | 5388 | } |
5004 | } | 5389 | } |
5005 | impl Literal {} | 5390 | impl Literal { |
5391 | pub fn literal_token(&self) -> Option<LiteralToken> { | ||
5392 | support::token(&self.syntax) | ||
5393 | } | ||
5394 | } | ||
5006 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5395 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
5007 | pub struct MatchExpr { | 5396 | pub struct MatchExpr { |
5008 | pub(crate) syntax: SyntaxNode, | 5397 | pub(crate) syntax: SyntaxNode, |
@@ -5030,12 +5419,16 @@ impl AstNode for MatchExpr { | |||
5030 | &self.syntax | 5419 | &self.syntax |
5031 | } | 5420 | } |
5032 | } | 5421 | } |
5422 | impl ast::AttrsOwner for MatchExpr {} | ||
5033 | impl MatchExpr { | 5423 | impl MatchExpr { |
5424 | pub fn match_kw(&self) -> Option<MatchKw> { | ||
5425 | support::token(&self.syntax) | ||
5426 | } | ||
5034 | pub fn expr(&self) -> Option<Expr> { | 5427 | pub fn expr(&self) -> Option<Expr> { |
5035 | AstChildren::new(&self.syntax).next() | 5428 | support::child(&self.syntax) |
5036 | } | 5429 | } |
5037 | pub fn match_arm_list(&self) -> Option<MatchArmList> { | 5430 | pub fn match_arm_list(&self) -> Option<MatchArmList> { |
5038 | AstChildren::new(&self.syntax).next() | 5431 | support::child(&self.syntax) |
5039 | } | 5432 | } |
5040 | } | 5433 | } |
5041 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5434 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5067,8 +5460,14 @@ impl AstNode for MatchArmList { | |||
5067 | } | 5460 | } |
5068 | impl ast::AttrsOwner for MatchArmList {} | 5461 | impl ast::AttrsOwner for MatchArmList {} |
5069 | impl MatchArmList { | 5462 | impl MatchArmList { |
5463 | pub fn l_curly(&self) -> Option<LCurly> { | ||
5464 | support::token(&self.syntax) | ||
5465 | } | ||
5070 | pub fn arms(&self) -> AstChildren<MatchArm> { | 5466 | pub fn arms(&self) -> AstChildren<MatchArm> { |
5071 | AstChildren::new(&self.syntax) | 5467 | support::children(&self.syntax) |
5468 | } | ||
5469 | pub fn r_curly(&self) -> Option<RCurly> { | ||
5470 | support::token(&self.syntax) | ||
5072 | } | 5471 | } |
5073 | } | 5472 | } |
5074 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5473 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5101,13 +5500,16 @@ impl AstNode for MatchArm { | |||
5101 | impl ast::AttrsOwner for MatchArm {} | 5500 | impl ast::AttrsOwner for MatchArm {} |
5102 | impl MatchArm { | 5501 | impl MatchArm { |
5103 | pub fn pat(&self) -> Option<Pat> { | 5502 | pub fn pat(&self) -> Option<Pat> { |
5104 | AstChildren::new(&self.syntax).next() | 5503 | support::child(&self.syntax) |
5105 | } | 5504 | } |
5106 | pub fn guard(&self) -> Option<MatchGuard> { | 5505 | pub fn guard(&self) -> Option<MatchGuard> { |
5107 | AstChildren::new(&self.syntax).next() | 5506 | support::child(&self.syntax) |
5507 | } | ||
5508 | pub fn fat_arrow(&self) -> Option<FatArrow> { | ||
5509 | support::token(&self.syntax) | ||
5108 | } | 5510 | } |
5109 | pub fn expr(&self) -> Option<Expr> { | 5511 | pub fn expr(&self) -> Option<Expr> { |
5110 | AstChildren::new(&self.syntax).next() | 5512 | support::child(&self.syntax) |
5111 | } | 5513 | } |
5112 | } | 5514 | } |
5113 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5515 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5138,8 +5540,11 @@ impl AstNode for MatchGuard { | |||
5138 | } | 5540 | } |
5139 | } | 5541 | } |
5140 | impl MatchGuard { | 5542 | impl MatchGuard { |
5543 | pub fn if_kw(&self) -> Option<IfKw> { | ||
5544 | support::token(&self.syntax) | ||
5545 | } | ||
5141 | pub fn expr(&self) -> Option<Expr> { | 5546 | pub fn expr(&self) -> Option<Expr> { |
5142 | AstChildren::new(&self.syntax).next() | 5547 | support::child(&self.syntax) |
5143 | } | 5548 | } |
5144 | } | 5549 | } |
5145 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5550 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5171,10 +5576,10 @@ impl AstNode for RecordLit { | |||
5171 | } | 5576 | } |
5172 | impl RecordLit { | 5577 | impl RecordLit { |
5173 | pub fn path(&self) -> Option<Path> { | 5578 | pub fn path(&self) -> Option<Path> { |
5174 | AstChildren::new(&self.syntax).next() | 5579 | support::child(&self.syntax) |
5175 | } | 5580 | } |
5176 | pub fn record_field_list(&self) -> Option<RecordFieldList> { | 5581 | pub fn record_field_list(&self) -> Option<RecordFieldList> { |
5177 | AstChildren::new(&self.syntax).next() | 5582 | support::child(&self.syntax) |
5178 | } | 5583 | } |
5179 | } | 5584 | } |
5180 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5585 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5205,11 +5610,20 @@ impl AstNode for RecordFieldList { | |||
5205 | } | 5610 | } |
5206 | } | 5611 | } |
5207 | impl RecordFieldList { | 5612 | impl RecordFieldList { |
5613 | pub fn l_curly(&self) -> Option<LCurly> { | ||
5614 | support::token(&self.syntax) | ||
5615 | } | ||
5208 | pub fn fields(&self) -> AstChildren<RecordField> { | 5616 | pub fn fields(&self) -> AstChildren<RecordField> { |
5209 | AstChildren::new(&self.syntax) | 5617 | support::children(&self.syntax) |
5618 | } | ||
5619 | pub fn dotdot(&self) -> Option<Dotdot> { | ||
5620 | support::token(&self.syntax) | ||
5210 | } | 5621 | } |
5211 | pub fn spread(&self) -> Option<Expr> { | 5622 | pub fn spread(&self) -> Option<Expr> { |
5212 | AstChildren::new(&self.syntax).next() | 5623 | support::child(&self.syntax) |
5624 | } | ||
5625 | pub fn r_curly(&self) -> Option<RCurly> { | ||
5626 | support::token(&self.syntax) | ||
5213 | } | 5627 | } |
5214 | } | 5628 | } |
5215 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5629 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5239,12 +5653,16 @@ impl AstNode for RecordField { | |||
5239 | &self.syntax | 5653 | &self.syntax |
5240 | } | 5654 | } |
5241 | } | 5655 | } |
5656 | impl ast::AttrsOwner for RecordField {} | ||
5242 | impl RecordField { | 5657 | impl RecordField { |
5243 | pub fn name_ref(&self) -> Option<NameRef> { | 5658 | pub fn name_ref(&self) -> Option<NameRef> { |
5244 | AstChildren::new(&self.syntax).next() | 5659 | support::child(&self.syntax) |
5660 | } | ||
5661 | pub fn colon(&self) -> Option<Colon> { | ||
5662 | support::token(&self.syntax) | ||
5245 | } | 5663 | } |
5246 | pub fn expr(&self) -> Option<Expr> { | 5664 | pub fn expr(&self) -> Option<Expr> { |
5247 | AstChildren::new(&self.syntax).next() | 5665 | support::child(&self.syntax) |
5248 | } | 5666 | } |
5249 | } | 5667 | } |
5250 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5668 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5276,7 +5694,7 @@ impl AstNode for OrPat { | |||
5276 | } | 5694 | } |
5277 | impl OrPat { | 5695 | impl OrPat { |
5278 | pub fn pats(&self) -> AstChildren<Pat> { | 5696 | pub fn pats(&self) -> AstChildren<Pat> { |
5279 | AstChildren::new(&self.syntax) | 5697 | support::children(&self.syntax) |
5280 | } | 5698 | } |
5281 | } | 5699 | } |
5282 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5700 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5307,8 +5725,14 @@ impl AstNode for ParenPat { | |||
5307 | } | 5725 | } |
5308 | } | 5726 | } |
5309 | impl ParenPat { | 5727 | impl ParenPat { |
5728 | pub fn l_paren(&self) -> Option<LParen> { | ||
5729 | support::token(&self.syntax) | ||
5730 | } | ||
5310 | pub fn pat(&self) -> Option<Pat> { | 5731 | pub fn pat(&self) -> Option<Pat> { |
5311 | AstChildren::new(&self.syntax).next() | 5732 | support::child(&self.syntax) |
5733 | } | ||
5734 | pub fn r_paren(&self) -> Option<RParen> { | ||
5735 | support::token(&self.syntax) | ||
5312 | } | 5736 | } |
5313 | } | 5737 | } |
5314 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5738 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5339,8 +5763,14 @@ impl AstNode for RefPat { | |||
5339 | } | 5763 | } |
5340 | } | 5764 | } |
5341 | impl RefPat { | 5765 | impl RefPat { |
5766 | pub fn amp(&self) -> Option<Amp> { | ||
5767 | support::token(&self.syntax) | ||
5768 | } | ||
5769 | pub fn mut_kw(&self) -> Option<MutKw> { | ||
5770 | support::token(&self.syntax) | ||
5771 | } | ||
5342 | pub fn pat(&self) -> Option<Pat> { | 5772 | pub fn pat(&self) -> Option<Pat> { |
5343 | AstChildren::new(&self.syntax).next() | 5773 | support::child(&self.syntax) |
5344 | } | 5774 | } |
5345 | } | 5775 | } |
5346 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5776 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5371,8 +5801,11 @@ impl AstNode for BoxPat { | |||
5371 | } | 5801 | } |
5372 | } | 5802 | } |
5373 | impl BoxPat { | 5803 | impl BoxPat { |
5804 | pub fn box_kw(&self) -> Option<BoxKw> { | ||
5805 | support::token(&self.syntax) | ||
5806 | } | ||
5374 | pub fn pat(&self) -> Option<Pat> { | 5807 | pub fn pat(&self) -> Option<Pat> { |
5375 | AstChildren::new(&self.syntax).next() | 5808 | support::child(&self.syntax) |
5376 | } | 5809 | } |
5377 | } | 5810 | } |
5378 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5811 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5402,10 +5835,17 @@ impl AstNode for BindPat { | |||
5402 | &self.syntax | 5835 | &self.syntax |
5403 | } | 5836 | } |
5404 | } | 5837 | } |
5838 | impl ast::AttrsOwner for BindPat {} | ||
5405 | impl ast::NameOwner for BindPat {} | 5839 | impl ast::NameOwner for BindPat {} |
5406 | impl BindPat { | 5840 | impl BindPat { |
5841 | pub fn ref_kw(&self) -> Option<RefKw> { | ||
5842 | support::token(&self.syntax) | ||
5843 | } | ||
5844 | pub fn mut_kw(&self) -> Option<MutKw> { | ||
5845 | support::token(&self.syntax) | ||
5846 | } | ||
5407 | pub fn pat(&self) -> Option<Pat> { | 5847 | pub fn pat(&self) -> Option<Pat> { |
5408 | AstChildren::new(&self.syntax).next() | 5848 | support::child(&self.syntax) |
5409 | } | 5849 | } |
5410 | } | 5850 | } |
5411 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5851 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5435,7 +5875,11 @@ impl AstNode for PlaceholderPat { | |||
5435 | &self.syntax | 5875 | &self.syntax |
5436 | } | 5876 | } |
5437 | } | 5877 | } |
5438 | impl PlaceholderPat {} | 5878 | impl PlaceholderPat { |
5879 | pub fn underscore(&self) -> Option<Underscore> { | ||
5880 | support::token(&self.syntax) | ||
5881 | } | ||
5882 | } | ||
5439 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5883 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
5440 | pub struct DotDotPat { | 5884 | pub struct DotDotPat { |
5441 | pub(crate) syntax: SyntaxNode, | 5885 | pub(crate) syntax: SyntaxNode, |
@@ -5463,7 +5907,11 @@ impl AstNode for DotDotPat { | |||
5463 | &self.syntax | 5907 | &self.syntax |
5464 | } | 5908 | } |
5465 | } | 5909 | } |
5466 | impl DotDotPat {} | 5910 | impl DotDotPat { |
5911 | pub fn dotdot(&self) -> Option<Dotdot> { | ||
5912 | support::token(&self.syntax) | ||
5913 | } | ||
5914 | } | ||
5467 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5915 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
5468 | pub struct PathPat { | 5916 | pub struct PathPat { |
5469 | pub(crate) syntax: SyntaxNode, | 5917 | pub(crate) syntax: SyntaxNode, |
@@ -5493,7 +5941,7 @@ impl AstNode for PathPat { | |||
5493 | } | 5941 | } |
5494 | impl PathPat { | 5942 | impl PathPat { |
5495 | pub fn path(&self) -> Option<Path> { | 5943 | pub fn path(&self) -> Option<Path> { |
5496 | AstChildren::new(&self.syntax).next() | 5944 | support::child(&self.syntax) |
5497 | } | 5945 | } |
5498 | } | 5946 | } |
5499 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5947 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5524,8 +5972,14 @@ impl AstNode for SlicePat { | |||
5524 | } | 5972 | } |
5525 | } | 5973 | } |
5526 | impl SlicePat { | 5974 | impl SlicePat { |
5975 | pub fn l_brack(&self) -> Option<LBrack> { | ||
5976 | support::token(&self.syntax) | ||
5977 | } | ||
5527 | pub fn args(&self) -> AstChildren<Pat> { | 5978 | pub fn args(&self) -> AstChildren<Pat> { |
5528 | AstChildren::new(&self.syntax) | 5979 | support::children(&self.syntax) |
5980 | } | ||
5981 | pub fn r_brack(&self) -> Option<RBrack> { | ||
5982 | support::token(&self.syntax) | ||
5529 | } | 5983 | } |
5530 | } | 5984 | } |
5531 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 5985 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5555,7 +6009,11 @@ impl AstNode for RangePat { | |||
5555 | &self.syntax | 6009 | &self.syntax |
5556 | } | 6010 | } |
5557 | } | 6011 | } |
5558 | impl RangePat {} | 6012 | impl RangePat { |
6013 | pub fn range_separator(&self) -> Option<RangeSeparator> { | ||
6014 | support::token(&self.syntax) | ||
6015 | } | ||
6016 | } | ||
5559 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6017 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
5560 | pub struct LiteralPat { | 6018 | pub struct LiteralPat { |
5561 | pub(crate) syntax: SyntaxNode, | 6019 | pub(crate) syntax: SyntaxNode, |
@@ -5585,7 +6043,7 @@ impl AstNode for LiteralPat { | |||
5585 | } | 6043 | } |
5586 | impl LiteralPat { | 6044 | impl LiteralPat { |
5587 | pub fn literal(&self) -> Option<Literal> { | 6045 | pub fn literal(&self) -> Option<Literal> { |
5588 | AstChildren::new(&self.syntax).next() | 6046 | support::child(&self.syntax) |
5589 | } | 6047 | } |
5590 | } | 6048 | } |
5591 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6049 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5617,7 +6075,7 @@ impl AstNode for MacroPat { | |||
5617 | } | 6075 | } |
5618 | impl MacroPat { | 6076 | impl MacroPat { |
5619 | pub fn macro_call(&self) -> Option<MacroCall> { | 6077 | pub fn macro_call(&self) -> Option<MacroCall> { |
5620 | AstChildren::new(&self.syntax).next() | 6078 | support::child(&self.syntax) |
5621 | } | 6079 | } |
5622 | } | 6080 | } |
5623 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6081 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5649,10 +6107,10 @@ impl AstNode for RecordPat { | |||
5649 | } | 6107 | } |
5650 | impl RecordPat { | 6108 | impl RecordPat { |
5651 | pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> { | 6109 | pub fn record_field_pat_list(&self) -> Option<RecordFieldPatList> { |
5652 | AstChildren::new(&self.syntax).next() | 6110 | support::child(&self.syntax) |
5653 | } | 6111 | } |
5654 | pub fn path(&self) -> Option<Path> { | 6112 | pub fn path(&self) -> Option<Path> { |
5655 | AstChildren::new(&self.syntax).next() | 6113 | support::child(&self.syntax) |
5656 | } | 6114 | } |
5657 | } | 6115 | } |
5658 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6116 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5683,11 +6141,23 @@ impl AstNode for RecordFieldPatList { | |||
5683 | } | 6141 | } |
5684 | } | 6142 | } |
5685 | impl RecordFieldPatList { | 6143 | impl RecordFieldPatList { |
6144 | pub fn l_curly(&self) -> Option<LCurly> { | ||
6145 | support::token(&self.syntax) | ||
6146 | } | ||
6147 | pub fn pats(&self) -> AstChildren<RecordInnerPat> { | ||
6148 | support::children(&self.syntax) | ||
6149 | } | ||
5686 | pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { | 6150 | pub fn record_field_pats(&self) -> AstChildren<RecordFieldPat> { |
5687 | AstChildren::new(&self.syntax) | 6151 | support::children(&self.syntax) |
5688 | } | 6152 | } |
5689 | pub fn bind_pats(&self) -> AstChildren<BindPat> { | 6153 | pub fn bind_pats(&self) -> AstChildren<BindPat> { |
5690 | AstChildren::new(&self.syntax) | 6154 | support::children(&self.syntax) |
6155 | } | ||
6156 | pub fn dotdot(&self) -> Option<Dotdot> { | ||
6157 | support::token(&self.syntax) | ||
6158 | } | ||
6159 | pub fn r_curly(&self) -> Option<RCurly> { | ||
6160 | support::token(&self.syntax) | ||
5691 | } | 6161 | } |
5692 | } | 6162 | } |
5693 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6163 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5717,10 +6187,14 @@ impl AstNode for RecordFieldPat { | |||
5717 | &self.syntax | 6187 | &self.syntax |
5718 | } | 6188 | } |
5719 | } | 6189 | } |
6190 | impl ast::AttrsOwner for RecordFieldPat {} | ||
5720 | impl ast::NameOwner for RecordFieldPat {} | 6191 | impl ast::NameOwner for RecordFieldPat {} |
5721 | impl RecordFieldPat { | 6192 | impl RecordFieldPat { |
6193 | pub fn colon(&self) -> Option<Colon> { | ||
6194 | support::token(&self.syntax) | ||
6195 | } | ||
5722 | pub fn pat(&self) -> Option<Pat> { | 6196 | pub fn pat(&self) -> Option<Pat> { |
5723 | AstChildren::new(&self.syntax).next() | 6197 | support::child(&self.syntax) |
5724 | } | 6198 | } |
5725 | } | 6199 | } |
5726 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6200 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5752,10 +6226,16 @@ impl AstNode for TupleStructPat { | |||
5752 | } | 6226 | } |
5753 | impl TupleStructPat { | 6227 | impl TupleStructPat { |
5754 | pub fn path(&self) -> Option<Path> { | 6228 | pub fn path(&self) -> Option<Path> { |
5755 | AstChildren::new(&self.syntax).next() | 6229 | support::child(&self.syntax) |
6230 | } | ||
6231 | pub fn l_paren(&self) -> Option<LParen> { | ||
6232 | support::token(&self.syntax) | ||
5756 | } | 6233 | } |
5757 | pub fn args(&self) -> AstChildren<Pat> { | 6234 | pub fn args(&self) -> AstChildren<Pat> { |
5758 | AstChildren::new(&self.syntax) | 6235 | support::children(&self.syntax) |
6236 | } | ||
6237 | pub fn r_paren(&self) -> Option<RParen> { | ||
6238 | support::token(&self.syntax) | ||
5759 | } | 6239 | } |
5760 | } | 6240 | } |
5761 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6241 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5786,8 +6266,14 @@ impl AstNode for TuplePat { | |||
5786 | } | 6266 | } |
5787 | } | 6267 | } |
5788 | impl TuplePat { | 6268 | impl TuplePat { |
6269 | pub fn l_paren(&self) -> Option<LParen> { | ||
6270 | support::token(&self.syntax) | ||
6271 | } | ||
5789 | pub fn args(&self) -> AstChildren<Pat> { | 6272 | pub fn args(&self) -> AstChildren<Pat> { |
5790 | AstChildren::new(&self.syntax) | 6273 | support::children(&self.syntax) |
6274 | } | ||
6275 | pub fn r_paren(&self) -> Option<RParen> { | ||
6276 | support::token(&self.syntax) | ||
5791 | } | 6277 | } |
5792 | } | 6278 | } |
5793 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6279 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5817,7 +6303,20 @@ impl AstNode for Visibility { | |||
5817 | &self.syntax | 6303 | &self.syntax |
5818 | } | 6304 | } |
5819 | } | 6305 | } |
5820 | impl Visibility {} | 6306 | impl Visibility { |
6307 | pub fn pub_kw(&self) -> Option<PubKw> { | ||
6308 | support::token(&self.syntax) | ||
6309 | } | ||
6310 | pub fn super_kw(&self) -> Option<SuperKw> { | ||
6311 | support::token(&self.syntax) | ||
6312 | } | ||
6313 | pub fn self_kw(&self) -> Option<SelfKw> { | ||
6314 | support::token(&self.syntax) | ||
6315 | } | ||
6316 | pub fn crate_kw(&self) -> Option<CrateKw> { | ||
6317 | support::token(&self.syntax) | ||
6318 | } | ||
6319 | } | ||
5821 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6320 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
5822 | pub struct Name { | 6321 | pub struct Name { |
5823 | pub(crate) syntax: SyntaxNode, | 6322 | pub(crate) syntax: SyntaxNode, |
@@ -5845,7 +6344,11 @@ impl AstNode for Name { | |||
5845 | &self.syntax | 6344 | &self.syntax |
5846 | } | 6345 | } |
5847 | } | 6346 | } |
5848 | impl Name {} | 6347 | impl Name { |
6348 | pub fn ident(&self) -> Option<Ident> { | ||
6349 | support::token(&self.syntax) | ||
6350 | } | ||
6351 | } | ||
5849 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6352 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
5850 | pub struct NameRef { | 6353 | pub struct NameRef { |
5851 | pub(crate) syntax: SyntaxNode, | 6354 | pub(crate) syntax: SyntaxNode, |
@@ -5873,7 +6376,11 @@ impl AstNode for NameRef { | |||
5873 | &self.syntax | 6376 | &self.syntax |
5874 | } | 6377 | } |
5875 | } | 6378 | } |
5876 | impl NameRef {} | 6379 | impl NameRef { |
6380 | pub fn name_ref_token(&self) -> Option<NameRefToken> { | ||
6381 | support::token(&self.syntax) | ||
6382 | } | ||
6383 | } | ||
5877 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6384 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
5878 | pub struct MacroCall { | 6385 | pub struct MacroCall { |
5879 | pub(crate) syntax: SyntaxNode, | 6386 | pub(crate) syntax: SyntaxNode, |
@@ -5905,11 +6412,17 @@ impl ast::NameOwner for MacroCall {} | |||
5905 | impl ast::AttrsOwner for MacroCall {} | 6412 | impl ast::AttrsOwner for MacroCall {} |
5906 | impl ast::DocCommentsOwner for MacroCall {} | 6413 | impl ast::DocCommentsOwner for MacroCall {} |
5907 | impl MacroCall { | 6414 | impl MacroCall { |
6415 | pub fn path(&self) -> Option<Path> { | ||
6416 | support::child(&self.syntax) | ||
6417 | } | ||
6418 | pub fn excl(&self) -> Option<Excl> { | ||
6419 | support::token(&self.syntax) | ||
6420 | } | ||
5908 | pub fn token_tree(&self) -> Option<TokenTree> { | 6421 | pub fn token_tree(&self) -> Option<TokenTree> { |
5909 | AstChildren::new(&self.syntax).next() | 6422 | support::child(&self.syntax) |
5910 | } | 6423 | } |
5911 | pub fn path(&self) -> Option<Path> { | 6424 | pub fn semi(&self) -> Option<Semi> { |
5912 | AstChildren::new(&self.syntax).next() | 6425 | support::token(&self.syntax) |
5913 | } | 6426 | } |
5914 | } | 6427 | } |
5915 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6428 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -5940,11 +6453,26 @@ impl AstNode for Attr { | |||
5940 | } | 6453 | } |
5941 | } | 6454 | } |
5942 | impl Attr { | 6455 | impl Attr { |
6456 | pub fn pound(&self) -> Option<Pound> { | ||
6457 | support::token(&self.syntax) | ||
6458 | } | ||
6459 | pub fn excl(&self) -> Option<Excl> { | ||
6460 | support::token(&self.syntax) | ||
6461 | } | ||
6462 | pub fn l_brack(&self) -> Option<LBrack> { | ||
6463 | support::token(&self.syntax) | ||
6464 | } | ||
5943 | pub fn path(&self) -> Option<Path> { | 6465 | pub fn path(&self) -> Option<Path> { |
5944 | AstChildren::new(&self.syntax).next() | 6466 | support::child(&self.syntax) |
6467 | } | ||
6468 | pub fn eq(&self) -> Option<Eq> { | ||
6469 | support::token(&self.syntax) | ||
5945 | } | 6470 | } |
5946 | pub fn input(&self) -> Option<AttrInput> { | 6471 | pub fn input(&self) -> Option<AttrInput> { |
5947 | AstChildren::new(&self.syntax).next() | 6472 | support::child(&self.syntax) |
6473 | } | ||
6474 | pub fn r_brack(&self) -> Option<RBrack> { | ||
6475 | support::token(&self.syntax) | ||
5948 | } | 6476 | } |
5949 | } | 6477 | } |
5950 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6478 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6003,11 +6531,23 @@ impl AstNode for TypeParamList { | |||
6003 | } | 6531 | } |
6004 | } | 6532 | } |
6005 | impl TypeParamList { | 6533 | impl TypeParamList { |
6534 | pub fn l_angle(&self) -> Option<LAngle> { | ||
6535 | support::token(&self.syntax) | ||
6536 | } | ||
6537 | pub fn generic_params(&self) -> AstChildren<GenericParam> { | ||
6538 | support::children(&self.syntax) | ||
6539 | } | ||
6006 | pub fn type_params(&self) -> AstChildren<TypeParam> { | 6540 | pub fn type_params(&self) -> AstChildren<TypeParam> { |
6007 | AstChildren::new(&self.syntax) | 6541 | support::children(&self.syntax) |
6008 | } | 6542 | } |
6009 | pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { | 6543 | pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { |
6010 | AstChildren::new(&self.syntax) | 6544 | support::children(&self.syntax) |
6545 | } | ||
6546 | pub fn const_params(&self) -> AstChildren<ConstParam> { | ||
6547 | support::children(&self.syntax) | ||
6548 | } | ||
6549 | pub fn r_angle(&self) -> Option<RAngle> { | ||
6550 | support::token(&self.syntax) | ||
6011 | } | 6551 | } |
6012 | } | 6552 | } |
6013 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6553 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6041,8 +6581,11 @@ impl ast::NameOwner for TypeParam {} | |||
6041 | impl ast::AttrsOwner for TypeParam {} | 6581 | impl ast::AttrsOwner for TypeParam {} |
6042 | impl ast::TypeBoundsOwner for TypeParam {} | 6582 | impl ast::TypeBoundsOwner for TypeParam {} |
6043 | impl TypeParam { | 6583 | impl TypeParam { |
6584 | pub fn eq(&self) -> Option<Eq> { | ||
6585 | support::token(&self.syntax) | ||
6586 | } | ||
6044 | pub fn default_type(&self) -> Option<TypeRef> { | 6587 | pub fn default_type(&self) -> Option<TypeRef> { |
6045 | AstChildren::new(&self.syntax).next() | 6588 | support::child(&self.syntax) |
6046 | } | 6589 | } |
6047 | } | 6590 | } |
6048 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6591 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6076,8 +6619,11 @@ impl ast::NameOwner for ConstParam {} | |||
6076 | impl ast::AttrsOwner for ConstParam {} | 6619 | impl ast::AttrsOwner for ConstParam {} |
6077 | impl ast::TypeAscriptionOwner for ConstParam {} | 6620 | impl ast::TypeAscriptionOwner for ConstParam {} |
6078 | impl ConstParam { | 6621 | impl ConstParam { |
6622 | pub fn eq(&self) -> Option<Eq> { | ||
6623 | support::token(&self.syntax) | ||
6624 | } | ||
6079 | pub fn default_val(&self) -> Option<Expr> { | 6625 | pub fn default_val(&self) -> Option<Expr> { |
6080 | AstChildren::new(&self.syntax).next() | 6626 | support::child(&self.syntax) |
6081 | } | 6627 | } |
6082 | } | 6628 | } |
6083 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6629 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6108,7 +6654,11 @@ impl AstNode for LifetimeParam { | |||
6108 | } | 6654 | } |
6109 | } | 6655 | } |
6110 | impl ast::AttrsOwner for LifetimeParam {} | 6656 | impl ast::AttrsOwner for LifetimeParam {} |
6111 | impl LifetimeParam {} | 6657 | impl LifetimeParam { |
6658 | pub fn lifetime(&self) -> Option<Lifetime> { | ||
6659 | support::token(&self.syntax) | ||
6660 | } | ||
6661 | } | ||
6112 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6662 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
6113 | pub struct TypeBound { | 6663 | pub struct TypeBound { |
6114 | pub(crate) syntax: SyntaxNode, | 6664 | pub(crate) syntax: SyntaxNode, |
@@ -6137,8 +6687,14 @@ impl AstNode for TypeBound { | |||
6137 | } | 6687 | } |
6138 | } | 6688 | } |
6139 | impl TypeBound { | 6689 | impl TypeBound { |
6690 | pub fn lifetime(&self) -> Option<Lifetime> { | ||
6691 | support::token(&self.syntax) | ||
6692 | } | ||
6693 | pub fn const_kw(&self) -> Option<ConstKw> { | ||
6694 | support::token(&self.syntax) | ||
6695 | } | ||
6140 | pub fn type_ref(&self) -> Option<TypeRef> { | 6696 | pub fn type_ref(&self) -> Option<TypeRef> { |
6141 | AstChildren::new(&self.syntax).next() | 6697 | support::child(&self.syntax) |
6142 | } | 6698 | } |
6143 | } | 6699 | } |
6144 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6700 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6170,7 +6726,7 @@ impl AstNode for TypeBoundList { | |||
6170 | } | 6726 | } |
6171 | impl TypeBoundList { | 6727 | impl TypeBoundList { |
6172 | pub fn bounds(&self) -> AstChildren<TypeBound> { | 6728 | pub fn bounds(&self) -> AstChildren<TypeBound> { |
6173 | AstChildren::new(&self.syntax) | 6729 | support::children(&self.syntax) |
6174 | } | 6730 | } |
6175 | } | 6731 | } |
6176 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6732 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6202,8 +6758,11 @@ impl AstNode for WherePred { | |||
6202 | } | 6758 | } |
6203 | impl ast::TypeBoundsOwner for WherePred {} | 6759 | impl ast::TypeBoundsOwner for WherePred {} |
6204 | impl WherePred { | 6760 | impl WherePred { |
6761 | pub fn lifetime(&self) -> Option<Lifetime> { | ||
6762 | support::token(&self.syntax) | ||
6763 | } | ||
6205 | pub fn type_ref(&self) -> Option<TypeRef> { | 6764 | pub fn type_ref(&self) -> Option<TypeRef> { |
6206 | AstChildren::new(&self.syntax).next() | 6765 | support::child(&self.syntax) |
6207 | } | 6766 | } |
6208 | } | 6767 | } |
6209 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6768 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6234,8 +6793,43 @@ impl AstNode for WhereClause { | |||
6234 | } | 6793 | } |
6235 | } | 6794 | } |
6236 | impl WhereClause { | 6795 | impl WhereClause { |
6796 | pub fn where_kw(&self) -> Option<WhereKw> { | ||
6797 | support::token(&self.syntax) | ||
6798 | } | ||
6237 | pub fn predicates(&self) -> AstChildren<WherePred> { | 6799 | pub fn predicates(&self) -> AstChildren<WherePred> { |
6238 | AstChildren::new(&self.syntax) | 6800 | support::children(&self.syntax) |
6801 | } | ||
6802 | } | ||
6803 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
6804 | pub struct Abi { | ||
6805 | pub(crate) syntax: SyntaxNode, | ||
6806 | } | ||
6807 | impl std::fmt::Display for Abi { | ||
6808 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
6809 | std::fmt::Display::fmt(self.syntax(), f) | ||
6810 | } | ||
6811 | } | ||
6812 | impl AstNode for Abi { | ||
6813 | fn can_cast(kind: SyntaxKind) -> bool { | ||
6814 | match kind { | ||
6815 | ABI => true, | ||
6816 | _ => false, | ||
6817 | } | ||
6818 | } | ||
6819 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
6820 | if Self::can_cast(syntax.kind()) { | ||
6821 | Some(Self { syntax }) | ||
6822 | } else { | ||
6823 | None | ||
6824 | } | ||
6825 | } | ||
6826 | fn syntax(&self) -> &SyntaxNode { | ||
6827 | &self.syntax | ||
6828 | } | ||
6829 | } | ||
6830 | impl Abi { | ||
6831 | pub fn string(&self) -> Option<String> { | ||
6832 | support::token(&self.syntax) | ||
6239 | } | 6833 | } |
6240 | } | 6834 | } |
6241 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6835 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6265,9 +6859,13 @@ impl AstNode for ExprStmt { | |||
6265 | &self.syntax | 6859 | &self.syntax |
6266 | } | 6860 | } |
6267 | } | 6861 | } |
6862 | impl ast::AttrsOwner for ExprStmt {} | ||
6268 | impl ExprStmt { | 6863 | impl ExprStmt { |
6269 | pub fn expr(&self) -> Option<Expr> { | 6864 | pub fn expr(&self) -> Option<Expr> { |
6270 | AstChildren::new(&self.syntax).next() | 6865 | support::child(&self.syntax) |
6866 | } | ||
6867 | pub fn semi(&self) -> Option<Semi> { | ||
6868 | support::token(&self.syntax) | ||
6271 | } | 6869 | } |
6272 | } | 6870 | } |
6273 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6871 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6297,13 +6895,20 @@ impl AstNode for LetStmt { | |||
6297 | &self.syntax | 6895 | &self.syntax |
6298 | } | 6896 | } |
6299 | } | 6897 | } |
6898 | impl ast::AttrsOwner for LetStmt {} | ||
6300 | impl ast::TypeAscriptionOwner for LetStmt {} | 6899 | impl ast::TypeAscriptionOwner for LetStmt {} |
6301 | impl LetStmt { | 6900 | impl LetStmt { |
6901 | pub fn let_kw(&self) -> Option<LetKw> { | ||
6902 | support::token(&self.syntax) | ||
6903 | } | ||
6302 | pub fn pat(&self) -> Option<Pat> { | 6904 | pub fn pat(&self) -> Option<Pat> { |
6303 | AstChildren::new(&self.syntax).next() | 6905 | support::child(&self.syntax) |
6906 | } | ||
6907 | pub fn eq(&self) -> Option<Eq> { | ||
6908 | support::token(&self.syntax) | ||
6304 | } | 6909 | } |
6305 | pub fn initializer(&self) -> Option<Expr> { | 6910 | pub fn initializer(&self) -> Option<Expr> { |
6306 | AstChildren::new(&self.syntax).next() | 6911 | support::child(&self.syntax) |
6307 | } | 6912 | } |
6308 | } | 6913 | } |
6309 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6914 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6334,11 +6939,17 @@ impl AstNode for Condition { | |||
6334 | } | 6939 | } |
6335 | } | 6940 | } |
6336 | impl Condition { | 6941 | impl Condition { |
6942 | pub fn let_kw(&self) -> Option<LetKw> { | ||
6943 | support::token(&self.syntax) | ||
6944 | } | ||
6337 | pub fn pat(&self) -> Option<Pat> { | 6945 | pub fn pat(&self) -> Option<Pat> { |
6338 | AstChildren::new(&self.syntax).next() | 6946 | support::child(&self.syntax) |
6947 | } | ||
6948 | pub fn eq(&self) -> Option<Eq> { | ||
6949 | support::token(&self.syntax) | ||
6339 | } | 6950 | } |
6340 | pub fn expr(&self) -> Option<Expr> { | 6951 | pub fn expr(&self) -> Option<Expr> { |
6341 | AstChildren::new(&self.syntax).next() | 6952 | support::child(&self.syntax) |
6342 | } | 6953 | } |
6343 | } | 6954 | } |
6344 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6955 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6371,11 +6982,17 @@ impl AstNode for Block { | |||
6371 | impl ast::AttrsOwner for Block {} | 6982 | impl ast::AttrsOwner for Block {} |
6372 | impl ast::ModuleItemOwner for Block {} | 6983 | impl ast::ModuleItemOwner for Block {} |
6373 | impl Block { | 6984 | impl Block { |
6985 | pub fn l_curly(&self) -> Option<LCurly> { | ||
6986 | support::token(&self.syntax) | ||
6987 | } | ||
6374 | pub fn statements(&self) -> AstChildren<Stmt> { | 6988 | pub fn statements(&self) -> AstChildren<Stmt> { |
6375 | AstChildren::new(&self.syntax) | 6989 | support::children(&self.syntax) |
6376 | } | 6990 | } |
6377 | pub fn expr(&self) -> Option<Expr> { | 6991 | pub fn expr(&self) -> Option<Expr> { |
6378 | AstChildren::new(&self.syntax).next() | 6992 | support::child(&self.syntax) |
6993 | } | ||
6994 | pub fn r_curly(&self) -> Option<RCurly> { | ||
6995 | support::token(&self.syntax) | ||
6379 | } | 6996 | } |
6380 | } | 6997 | } |
6381 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 6998 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6406,11 +7023,17 @@ impl AstNode for ParamList { | |||
6406 | } | 7023 | } |
6407 | } | 7024 | } |
6408 | impl ParamList { | 7025 | impl ParamList { |
7026 | pub fn l_paren(&self) -> Option<LParen> { | ||
7027 | support::token(&self.syntax) | ||
7028 | } | ||
6409 | pub fn self_param(&self) -> Option<SelfParam> { | 7029 | pub fn self_param(&self) -> Option<SelfParam> { |
6410 | AstChildren::new(&self.syntax).next() | 7030 | support::child(&self.syntax) |
6411 | } | 7031 | } |
6412 | pub fn params(&self) -> AstChildren<Param> { | 7032 | pub fn params(&self) -> AstChildren<Param> { |
6413 | AstChildren::new(&self.syntax) | 7033 | support::children(&self.syntax) |
7034 | } | ||
7035 | pub fn r_paren(&self) -> Option<RParen> { | ||
7036 | support::token(&self.syntax) | ||
6414 | } | 7037 | } |
6415 | } | 7038 | } |
6416 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7039 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6442,7 +7065,17 @@ impl AstNode for SelfParam { | |||
6442 | } | 7065 | } |
6443 | impl ast::TypeAscriptionOwner for SelfParam {} | 7066 | impl ast::TypeAscriptionOwner for SelfParam {} |
6444 | impl ast::AttrsOwner for SelfParam {} | 7067 | impl ast::AttrsOwner for SelfParam {} |
6445 | impl SelfParam {} | 7068 | impl SelfParam { |
7069 | pub fn amp(&self) -> Option<Amp> { | ||
7070 | support::token(&self.syntax) | ||
7071 | } | ||
7072 | pub fn lifetime(&self) -> Option<Lifetime> { | ||
7073 | support::token(&self.syntax) | ||
7074 | } | ||
7075 | pub fn self_kw(&self) -> Option<SelfKw> { | ||
7076 | support::token(&self.syntax) | ||
7077 | } | ||
7078 | } | ||
6446 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7079 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
6447 | pub struct Param { | 7080 | pub struct Param { |
6448 | pub(crate) syntax: SyntaxNode, | 7081 | pub(crate) syntax: SyntaxNode, |
@@ -6474,7 +7107,10 @@ impl ast::TypeAscriptionOwner for Param {} | |||
6474 | impl ast::AttrsOwner for Param {} | 7107 | impl ast::AttrsOwner for Param {} |
6475 | impl Param { | 7108 | impl Param { |
6476 | pub fn pat(&self) -> Option<Pat> { | 7109 | pub fn pat(&self) -> Option<Pat> { |
6477 | AstChildren::new(&self.syntax).next() | 7110 | support::child(&self.syntax) |
7111 | } | ||
7112 | pub fn dotdotdot(&self) -> Option<Dotdotdot> { | ||
7113 | support::token(&self.syntax) | ||
6478 | } | 7114 | } |
6479 | } | 7115 | } |
6480 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7116 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6507,8 +7143,11 @@ impl AstNode for UseItem { | |||
6507 | impl ast::AttrsOwner for UseItem {} | 7143 | impl ast::AttrsOwner for UseItem {} |
6508 | impl ast::VisibilityOwner for UseItem {} | 7144 | impl ast::VisibilityOwner for UseItem {} |
6509 | impl UseItem { | 7145 | impl UseItem { |
7146 | pub fn use_kw(&self) -> Option<UseKw> { | ||
7147 | support::token(&self.syntax) | ||
7148 | } | ||
6510 | pub fn use_tree(&self) -> Option<UseTree> { | 7149 | pub fn use_tree(&self) -> Option<UseTree> { |
6511 | AstChildren::new(&self.syntax).next() | 7150 | support::child(&self.syntax) |
6512 | } | 7151 | } |
6513 | } | 7152 | } |
6514 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7153 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6540,13 +7179,16 @@ impl AstNode for UseTree { | |||
6540 | } | 7179 | } |
6541 | impl UseTree { | 7180 | impl UseTree { |
6542 | pub fn path(&self) -> Option<Path> { | 7181 | pub fn path(&self) -> Option<Path> { |
6543 | AstChildren::new(&self.syntax).next() | 7182 | support::child(&self.syntax) |
7183 | } | ||
7184 | pub fn star(&self) -> Option<Star> { | ||
7185 | support::token(&self.syntax) | ||
6544 | } | 7186 | } |
6545 | pub fn use_tree_list(&self) -> Option<UseTreeList> { | 7187 | pub fn use_tree_list(&self) -> Option<UseTreeList> { |
6546 | AstChildren::new(&self.syntax).next() | 7188 | support::child(&self.syntax) |
6547 | } | 7189 | } |
6548 | pub fn alias(&self) -> Option<Alias> { | 7190 | pub fn alias(&self) -> Option<Alias> { |
6549 | AstChildren::new(&self.syntax).next() | 7191 | support::child(&self.syntax) |
6550 | } | 7192 | } |
6551 | } | 7193 | } |
6552 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7194 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6577,7 +7219,11 @@ impl AstNode for Alias { | |||
6577 | } | 7219 | } |
6578 | } | 7220 | } |
6579 | impl ast::NameOwner for Alias {} | 7221 | impl ast::NameOwner for Alias {} |
6580 | impl Alias {} | 7222 | impl Alias { |
7223 | pub fn as_kw(&self) -> Option<AsKw> { | ||
7224 | support::token(&self.syntax) | ||
7225 | } | ||
7226 | } | ||
6581 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7227 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
6582 | pub struct UseTreeList { | 7228 | pub struct UseTreeList { |
6583 | pub(crate) syntax: SyntaxNode, | 7229 | pub(crate) syntax: SyntaxNode, |
@@ -6606,8 +7252,14 @@ impl AstNode for UseTreeList { | |||
6606 | } | 7252 | } |
6607 | } | 7253 | } |
6608 | impl UseTreeList { | 7254 | impl UseTreeList { |
7255 | pub fn l_curly(&self) -> Option<LCurly> { | ||
7256 | support::token(&self.syntax) | ||
7257 | } | ||
6609 | pub fn use_trees(&self) -> AstChildren<UseTree> { | 7258 | pub fn use_trees(&self) -> AstChildren<UseTree> { |
6610 | AstChildren::new(&self.syntax) | 7259 | support::children(&self.syntax) |
7260 | } | ||
7261 | pub fn r_curly(&self) -> Option<RCurly> { | ||
7262 | support::token(&self.syntax) | ||
6611 | } | 7263 | } |
6612 | } | 7264 | } |
6613 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7265 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6640,11 +7292,17 @@ impl AstNode for ExternCrateItem { | |||
6640 | impl ast::AttrsOwner for ExternCrateItem {} | 7292 | impl ast::AttrsOwner for ExternCrateItem {} |
6641 | impl ast::VisibilityOwner for ExternCrateItem {} | 7293 | impl ast::VisibilityOwner for ExternCrateItem {} |
6642 | impl ExternCrateItem { | 7294 | impl ExternCrateItem { |
7295 | pub fn extern_kw(&self) -> Option<ExternKw> { | ||
7296 | support::token(&self.syntax) | ||
7297 | } | ||
7298 | pub fn crate_kw(&self) -> Option<CrateKw> { | ||
7299 | support::token(&self.syntax) | ||
7300 | } | ||
6643 | pub fn name_ref(&self) -> Option<NameRef> { | 7301 | pub fn name_ref(&self) -> Option<NameRef> { |
6644 | AstChildren::new(&self.syntax).next() | 7302 | support::child(&self.syntax) |
6645 | } | 7303 | } |
6646 | pub fn alias(&self) -> Option<Alias> { | 7304 | pub fn alias(&self) -> Option<Alias> { |
6647 | AstChildren::new(&self.syntax).next() | 7305 | support::child(&self.syntax) |
6648 | } | 7306 | } |
6649 | } | 7307 | } |
6650 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7308 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6675,8 +7333,14 @@ impl AstNode for ArgList { | |||
6675 | } | 7333 | } |
6676 | } | 7334 | } |
6677 | impl ArgList { | 7335 | impl ArgList { |
7336 | pub fn l_paren(&self) -> Option<LParen> { | ||
7337 | support::token(&self.syntax) | ||
7338 | } | ||
6678 | pub fn args(&self) -> AstChildren<Expr> { | 7339 | pub fn args(&self) -> AstChildren<Expr> { |
6679 | AstChildren::new(&self.syntax) | 7340 | support::children(&self.syntax) |
7341 | } | ||
7342 | pub fn r_paren(&self) -> Option<RParen> { | ||
7343 | support::token(&self.syntax) | ||
6680 | } | 7344 | } |
6681 | } | 7345 | } |
6682 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7346 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6708,10 +7372,10 @@ impl AstNode for Path { | |||
6708 | } | 7372 | } |
6709 | impl Path { | 7373 | impl Path { |
6710 | pub fn segment(&self) -> Option<PathSegment> { | 7374 | pub fn segment(&self) -> Option<PathSegment> { |
6711 | AstChildren::new(&self.syntax).next() | 7375 | support::child(&self.syntax) |
6712 | } | 7376 | } |
6713 | pub fn qualifier(&self) -> Option<Path> { | 7377 | pub fn qualifier(&self) -> Option<Path> { |
6714 | AstChildren::new(&self.syntax).next() | 7378 | support::child(&self.syntax) |
6715 | } | 7379 | } |
6716 | } | 7380 | } |
6717 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7381 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6742,20 +7406,29 @@ impl AstNode for PathSegment { | |||
6742 | } | 7406 | } |
6743 | } | 7407 | } |
6744 | impl PathSegment { | 7408 | impl PathSegment { |
7409 | pub fn coloncolon(&self) -> Option<Coloncolon> { | ||
7410 | support::token(&self.syntax) | ||
7411 | } | ||
7412 | pub fn l_angle(&self) -> Option<LAngle> { | ||
7413 | support::token(&self.syntax) | ||
7414 | } | ||
6745 | pub fn name_ref(&self) -> Option<NameRef> { | 7415 | pub fn name_ref(&self) -> Option<NameRef> { |
6746 | AstChildren::new(&self.syntax).next() | 7416 | support::child(&self.syntax) |
6747 | } | 7417 | } |
6748 | pub fn type_arg_list(&self) -> Option<TypeArgList> { | 7418 | pub fn type_arg_list(&self) -> Option<TypeArgList> { |
6749 | AstChildren::new(&self.syntax).next() | 7419 | support::child(&self.syntax) |
6750 | } | 7420 | } |
6751 | pub fn param_list(&self) -> Option<ParamList> { | 7421 | pub fn param_list(&self) -> Option<ParamList> { |
6752 | AstChildren::new(&self.syntax).next() | 7422 | support::child(&self.syntax) |
6753 | } | 7423 | } |
6754 | pub fn ret_type(&self) -> Option<RetType> { | 7424 | pub fn ret_type(&self) -> Option<RetType> { |
6755 | AstChildren::new(&self.syntax).next() | 7425 | support::child(&self.syntax) |
6756 | } | 7426 | } |
6757 | pub fn path_type(&self) -> Option<PathType> { | 7427 | pub fn path_type(&self) -> Option<PathType> { |
6758 | AstChildren::new(&self.syntax).next() | 7428 | support::child(&self.syntax) |
7429 | } | ||
7430 | pub fn r_angle(&self) -> Option<RAngle> { | ||
7431 | support::token(&self.syntax) | ||
6759 | } | 7432 | } |
6760 | } | 7433 | } |
6761 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7434 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6786,17 +7459,29 @@ impl AstNode for TypeArgList { | |||
6786 | } | 7459 | } |
6787 | } | 7460 | } |
6788 | impl TypeArgList { | 7461 | impl TypeArgList { |
7462 | pub fn coloncolon(&self) -> Option<Coloncolon> { | ||
7463 | support::token(&self.syntax) | ||
7464 | } | ||
7465 | pub fn l_angle(&self) -> Option<LAngle> { | ||
7466 | support::token(&self.syntax) | ||
7467 | } | ||
7468 | pub fn generic_args(&self) -> AstChildren<GenericArg> { | ||
7469 | support::children(&self.syntax) | ||
7470 | } | ||
6789 | pub fn type_args(&self) -> AstChildren<TypeArg> { | 7471 | pub fn type_args(&self) -> AstChildren<TypeArg> { |
6790 | AstChildren::new(&self.syntax) | 7472 | support::children(&self.syntax) |
6791 | } | 7473 | } |
6792 | pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { | 7474 | pub fn lifetime_args(&self) -> AstChildren<LifetimeArg> { |
6793 | AstChildren::new(&self.syntax) | 7475 | support::children(&self.syntax) |
6794 | } | 7476 | } |
6795 | pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { | 7477 | pub fn assoc_type_args(&self) -> AstChildren<AssocTypeArg> { |
6796 | AstChildren::new(&self.syntax) | 7478 | support::children(&self.syntax) |
7479 | } | ||
7480 | pub fn const_args(&self) -> AstChildren<ConstArg> { | ||
7481 | support::children(&self.syntax) | ||
6797 | } | 7482 | } |
6798 | pub fn const_arg(&self) -> AstChildren<ConstArg> { | 7483 | pub fn r_angle(&self) -> Option<RAngle> { |
6799 | AstChildren::new(&self.syntax) | 7484 | support::token(&self.syntax) |
6800 | } | 7485 | } |
6801 | } | 7486 | } |
6802 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7487 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6828,7 +7513,7 @@ impl AstNode for TypeArg { | |||
6828 | } | 7513 | } |
6829 | impl TypeArg { | 7514 | impl TypeArg { |
6830 | pub fn type_ref(&self) -> Option<TypeRef> { | 7515 | pub fn type_ref(&self) -> Option<TypeRef> { |
6831 | AstChildren::new(&self.syntax).next() | 7516 | support::child(&self.syntax) |
6832 | } | 7517 | } |
6833 | } | 7518 | } |
6834 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7519 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6858,12 +7543,16 @@ impl AstNode for AssocTypeArg { | |||
6858 | &self.syntax | 7543 | &self.syntax |
6859 | } | 7544 | } |
6860 | } | 7545 | } |
7546 | impl ast::TypeBoundsOwner for AssocTypeArg {} | ||
6861 | impl AssocTypeArg { | 7547 | impl AssocTypeArg { |
6862 | pub fn name_ref(&self) -> Option<NameRef> { | 7548 | pub fn name_ref(&self) -> Option<NameRef> { |
6863 | AstChildren::new(&self.syntax).next() | 7549 | support::child(&self.syntax) |
7550 | } | ||
7551 | pub fn eq(&self) -> Option<Eq> { | ||
7552 | support::token(&self.syntax) | ||
6864 | } | 7553 | } |
6865 | pub fn type_ref(&self) -> Option<TypeRef> { | 7554 | pub fn type_ref(&self) -> Option<TypeRef> { |
6866 | AstChildren::new(&self.syntax).next() | 7555 | support::child(&self.syntax) |
6867 | } | 7556 | } |
6868 | } | 7557 | } |
6869 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7558 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6893,7 +7582,11 @@ impl AstNode for LifetimeArg { | |||
6893 | &self.syntax | 7582 | &self.syntax |
6894 | } | 7583 | } |
6895 | } | 7584 | } |
6896 | impl LifetimeArg {} | 7585 | impl LifetimeArg { |
7586 | pub fn lifetime(&self) -> Option<Lifetime> { | ||
7587 | support::token(&self.syntax) | ||
7588 | } | ||
7589 | } | ||
6897 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7590 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
6898 | pub struct ConstArg { | 7591 | pub struct ConstArg { |
6899 | pub(crate) syntax: SyntaxNode, | 7592 | pub(crate) syntax: SyntaxNode, |
@@ -6923,10 +7616,13 @@ impl AstNode for ConstArg { | |||
6923 | } | 7616 | } |
6924 | impl ConstArg { | 7617 | impl ConstArg { |
6925 | pub fn literal(&self) -> Option<Literal> { | 7618 | pub fn literal(&self) -> Option<Literal> { |
6926 | AstChildren::new(&self.syntax).next() | 7619 | support::child(&self.syntax) |
7620 | } | ||
7621 | pub fn eq(&self) -> Option<Eq> { | ||
7622 | support::token(&self.syntax) | ||
6927 | } | 7623 | } |
6928 | pub fn block_expr(&self) -> Option<BlockExpr> { | 7624 | pub fn block_expr(&self) -> Option<BlockExpr> { |
6929 | AstChildren::new(&self.syntax).next() | 7625 | support::child(&self.syntax) |
6930 | } | 7626 | } |
6931 | } | 7627 | } |
6932 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7628 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -6988,10 +7684,161 @@ impl AstNode for MacroStmts { | |||
6988 | } | 7684 | } |
6989 | impl MacroStmts { | 7685 | impl MacroStmts { |
6990 | pub fn statements(&self) -> AstChildren<Stmt> { | 7686 | pub fn statements(&self) -> AstChildren<Stmt> { |
6991 | AstChildren::new(&self.syntax) | 7687 | support::children(&self.syntax) |
6992 | } | 7688 | } |
6993 | pub fn expr(&self) -> Option<Expr> { | 7689 | pub fn expr(&self) -> Option<Expr> { |
6994 | AstChildren::new(&self.syntax).next() | 7690 | support::child(&self.syntax) |
7691 | } | ||
7692 | } | ||
7693 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
7694 | pub struct ExternItemList { | ||
7695 | pub(crate) syntax: SyntaxNode, | ||
7696 | } | ||
7697 | impl std::fmt::Display for ExternItemList { | ||
7698 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
7699 | std::fmt::Display::fmt(self.syntax(), f) | ||
7700 | } | ||
7701 | } | ||
7702 | impl AstNode for ExternItemList { | ||
7703 | fn can_cast(kind: SyntaxKind) -> bool { | ||
7704 | match kind { | ||
7705 | EXTERN_ITEM_LIST => true, | ||
7706 | _ => false, | ||
7707 | } | ||
7708 | } | ||
7709 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
7710 | if Self::can_cast(syntax.kind()) { | ||
7711 | Some(Self { syntax }) | ||
7712 | } else { | ||
7713 | None | ||
7714 | } | ||
7715 | } | ||
7716 | fn syntax(&self) -> &SyntaxNode { | ||
7717 | &self.syntax | ||
7718 | } | ||
7719 | } | ||
7720 | impl ast::FnDefOwner for ExternItemList {} | ||
7721 | impl ast::ModuleItemOwner for ExternItemList {} | ||
7722 | impl ExternItemList { | ||
7723 | pub fn l_curly(&self) -> Option<LCurly> { | ||
7724 | support::token(&self.syntax) | ||
7725 | } | ||
7726 | pub fn extern_items(&self) -> AstChildren<ExternItem> { | ||
7727 | support::children(&self.syntax) | ||
7728 | } | ||
7729 | pub fn r_curly(&self) -> Option<RCurly> { | ||
7730 | support::token(&self.syntax) | ||
7731 | } | ||
7732 | } | ||
7733 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
7734 | pub struct ExternBlock { | ||
7735 | pub(crate) syntax: SyntaxNode, | ||
7736 | } | ||
7737 | impl std::fmt::Display for ExternBlock { | ||
7738 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
7739 | std::fmt::Display::fmt(self.syntax(), f) | ||
7740 | } | ||
7741 | } | ||
7742 | impl AstNode for ExternBlock { | ||
7743 | fn can_cast(kind: SyntaxKind) -> bool { | ||
7744 | match kind { | ||
7745 | EXTERN_BLOCK => true, | ||
7746 | _ => false, | ||
7747 | } | ||
7748 | } | ||
7749 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
7750 | if Self::can_cast(syntax.kind()) { | ||
7751 | Some(Self { syntax }) | ||
7752 | } else { | ||
7753 | None | ||
7754 | } | ||
7755 | } | ||
7756 | fn syntax(&self) -> &SyntaxNode { | ||
7757 | &self.syntax | ||
7758 | } | ||
7759 | } | ||
7760 | impl ExternBlock { | ||
7761 | pub fn abi(&self) -> Option<Abi> { | ||
7762 | support::child(&self.syntax) | ||
7763 | } | ||
7764 | pub fn extern_item_list(&self) -> Option<ExternItemList> { | ||
7765 | support::child(&self.syntax) | ||
7766 | } | ||
7767 | } | ||
7768 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
7769 | pub struct MetaItem { | ||
7770 | pub(crate) syntax: SyntaxNode, | ||
7771 | } | ||
7772 | impl std::fmt::Display for MetaItem { | ||
7773 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
7774 | std::fmt::Display::fmt(self.syntax(), f) | ||
7775 | } | ||
7776 | } | ||
7777 | impl AstNode for MetaItem { | ||
7778 | fn can_cast(kind: SyntaxKind) -> bool { | ||
7779 | match kind { | ||
7780 | META_ITEM => true, | ||
7781 | _ => false, | ||
7782 | } | ||
7783 | } | ||
7784 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
7785 | if Self::can_cast(syntax.kind()) { | ||
7786 | Some(Self { syntax }) | ||
7787 | } else { | ||
7788 | None | ||
7789 | } | ||
7790 | } | ||
7791 | fn syntax(&self) -> &SyntaxNode { | ||
7792 | &self.syntax | ||
7793 | } | ||
7794 | } | ||
7795 | impl MetaItem { | ||
7796 | pub fn path(&self) -> Option<Path> { | ||
7797 | support::child(&self.syntax) | ||
7798 | } | ||
7799 | pub fn eq(&self) -> Option<Eq> { | ||
7800 | support::token(&self.syntax) | ||
7801 | } | ||
7802 | pub fn attr_input(&self) -> Option<AttrInput> { | ||
7803 | support::child(&self.syntax) | ||
7804 | } | ||
7805 | pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { | ||
7806 | support::children(&self.syntax) | ||
7807 | } | ||
7808 | } | ||
7809 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
7810 | pub struct MacroDef { | ||
7811 | pub(crate) syntax: SyntaxNode, | ||
7812 | } | ||
7813 | impl std::fmt::Display for MacroDef { | ||
7814 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
7815 | std::fmt::Display::fmt(self.syntax(), f) | ||
7816 | } | ||
7817 | } | ||
7818 | impl AstNode for MacroDef { | ||
7819 | fn can_cast(kind: SyntaxKind) -> bool { | ||
7820 | match kind { | ||
7821 | MACRO_DEF => true, | ||
7822 | _ => false, | ||
7823 | } | ||
7824 | } | ||
7825 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
7826 | if Self::can_cast(syntax.kind()) { | ||
7827 | Some(Self { syntax }) | ||
7828 | } else { | ||
7829 | None | ||
7830 | } | ||
7831 | } | ||
7832 | fn syntax(&self) -> &SyntaxNode { | ||
7833 | &self.syntax | ||
7834 | } | ||
7835 | } | ||
7836 | impl MacroDef { | ||
7837 | pub fn name(&self) -> Option<Name> { | ||
7838 | support::child(&self.syntax) | ||
7839 | } | ||
7840 | pub fn token_tree(&self) -> Option<TokenTree> { | ||
7841 | support::child(&self.syntax) | ||
6995 | } | 7842 | } |
6996 | } | 7843 | } |
6997 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7844 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -7048,6 +7895,114 @@ impl ast::NameOwner for NominalDef {} | |||
7048 | impl ast::TypeParamsOwner for NominalDef {} | 7895 | impl ast::TypeParamsOwner for NominalDef {} |
7049 | impl ast::AttrsOwner for NominalDef {} | 7896 | impl ast::AttrsOwner for NominalDef {} |
7050 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 7897 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
7898 | pub enum GenericParam { | ||
7899 | LifetimeParam(LifetimeParam), | ||
7900 | TypeParam(TypeParam), | ||
7901 | ConstParam(ConstParam), | ||
7902 | } | ||
7903 | impl From<LifetimeParam> for GenericParam { | ||
7904 | fn from(node: LifetimeParam) -> GenericParam { | ||
7905 | GenericParam::LifetimeParam(node) | ||
7906 | } | ||
7907 | } | ||
7908 | impl From<TypeParam> for GenericParam { | ||
7909 | fn from(node: TypeParam) -> GenericParam { | ||
7910 | GenericParam::TypeParam(node) | ||
7911 | } | ||
7912 | } | ||
7913 | impl From<ConstParam> for GenericParam { | ||
7914 | fn from(node: ConstParam) -> GenericParam { | ||
7915 | GenericParam::ConstParam(node) | ||
7916 | } | ||
7917 | } | ||
7918 | impl std::fmt::Display for GenericParam { | ||
7919 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
7920 | std::fmt::Display::fmt(self.syntax(), f) | ||
7921 | } | ||
7922 | } | ||
7923 | impl AstNode for GenericParam { | ||
7924 | fn can_cast(kind: SyntaxKind) -> bool { | ||
7925 | match kind { | ||
7926 | LIFETIME_PARAM | TYPE_PARAM | CONST_PARAM => true, | ||
7927 | _ => false, | ||
7928 | } | ||
7929 | } | ||
7930 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
7931 | let res = match syntax.kind() { | ||
7932 | LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }), | ||
7933 | TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }), | ||
7934 | CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }), | ||
7935 | _ => return None, | ||
7936 | }; | ||
7937 | Some(res) | ||
7938 | } | ||
7939 | fn syntax(&self) -> &SyntaxNode { | ||
7940 | match self { | ||
7941 | GenericParam::LifetimeParam(it) => &it.syntax, | ||
7942 | GenericParam::TypeParam(it) => &it.syntax, | ||
7943 | GenericParam::ConstParam(it) => &it.syntax, | ||
7944 | } | ||
7945 | } | ||
7946 | } | ||
7947 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
7948 | pub enum GenericArg { | ||
7949 | LifetimeArg(LifetimeArg), | ||
7950 | TypeArg(TypeArg), | ||
7951 | ConstArg(ConstArg), | ||
7952 | AssocTypeArg(AssocTypeArg), | ||
7953 | } | ||
7954 | impl From<LifetimeArg> for GenericArg { | ||
7955 | fn from(node: LifetimeArg) -> GenericArg { | ||
7956 | GenericArg::LifetimeArg(node) | ||
7957 | } | ||
7958 | } | ||
7959 | impl From<TypeArg> for GenericArg { | ||
7960 | fn from(node: TypeArg) -> GenericArg { | ||
7961 | GenericArg::TypeArg(node) | ||
7962 | } | ||
7963 | } | ||
7964 | impl From<ConstArg> for GenericArg { | ||
7965 | fn from(node: ConstArg) -> GenericArg { | ||
7966 | GenericArg::ConstArg(node) | ||
7967 | } | ||
7968 | } | ||
7969 | impl From<AssocTypeArg> for GenericArg { | ||
7970 | fn from(node: AssocTypeArg) -> GenericArg { | ||
7971 | GenericArg::AssocTypeArg(node) | ||
7972 | } | ||
7973 | } | ||
7974 | impl std::fmt::Display for GenericArg { | ||
7975 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
7976 | std::fmt::Display::fmt(self.syntax(), f) | ||
7977 | } | ||
7978 | } | ||
7979 | impl AstNode for GenericArg { | ||
7980 | fn can_cast(kind: SyntaxKind) -> bool { | ||
7981 | match kind { | ||
7982 | LIFETIME_ARG | TYPE_ARG | CONST_ARG | ASSOC_TYPE_ARG => true, | ||
7983 | _ => false, | ||
7984 | } | ||
7985 | } | ||
7986 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
7987 | let res = match syntax.kind() { | ||
7988 | LIFETIME_ARG => GenericArg::LifetimeArg(LifetimeArg { syntax }), | ||
7989 | TYPE_ARG => GenericArg::TypeArg(TypeArg { syntax }), | ||
7990 | CONST_ARG => GenericArg::ConstArg(ConstArg { syntax }), | ||
7991 | ASSOC_TYPE_ARG => GenericArg::AssocTypeArg(AssocTypeArg { syntax }), | ||
7992 | _ => return None, | ||
7993 | }; | ||
7994 | Some(res) | ||
7995 | } | ||
7996 | fn syntax(&self) -> &SyntaxNode { | ||
7997 | match self { | ||
7998 | GenericArg::LifetimeArg(it) => &it.syntax, | ||
7999 | GenericArg::TypeArg(it) => &it.syntax, | ||
8000 | GenericArg::ConstArg(it) => &it.syntax, | ||
8001 | GenericArg::AssocTypeArg(it) => &it.syntax, | ||
8002 | } | ||
8003 | } | ||
8004 | } | ||
8005 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
7051 | pub enum TypeRef { | 8006 | pub enum TypeRef { |
7052 | ParenType(ParenType), | 8007 | ParenType(ParenType), |
7053 | TupleType(TupleType), | 8008 | TupleType(TupleType), |
@@ -7194,6 +8149,7 @@ pub enum ModuleItem { | |||
7194 | StaticDef(StaticDef), | 8149 | StaticDef(StaticDef), |
7195 | Module(Module), | 8150 | Module(Module), |
7196 | MacroCall(MacroCall), | 8151 | MacroCall(MacroCall), |
8152 | ExternBlock(ExternBlock), | ||
7197 | } | 8153 | } |
7198 | impl From<StructDef> for ModuleItem { | 8154 | impl From<StructDef> for ModuleItem { |
7199 | fn from(node: StructDef) -> ModuleItem { | 8155 | fn from(node: StructDef) -> ModuleItem { |
@@ -7260,6 +8216,11 @@ impl From<MacroCall> for ModuleItem { | |||
7260 | ModuleItem::MacroCall(node) | 8216 | ModuleItem::MacroCall(node) |
7261 | } | 8217 | } |
7262 | } | 8218 | } |
8219 | impl From<ExternBlock> for ModuleItem { | ||
8220 | fn from(node: ExternBlock) -> ModuleItem { | ||
8221 | ModuleItem::ExternBlock(node) | ||
8222 | } | ||
8223 | } | ||
7263 | impl std::fmt::Display for ModuleItem { | 8224 | impl std::fmt::Display for ModuleItem { |
7264 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 8225 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
7265 | std::fmt::Display::fmt(self.syntax(), f) | 8226 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -7269,7 +8230,8 @@ impl AstNode for ModuleItem { | |||
7269 | fn can_cast(kind: SyntaxKind) -> bool { | 8230 | fn can_cast(kind: SyntaxKind) -> bool { |
7270 | match kind { | 8231 | match kind { |
7271 | STRUCT_DEF | UNION_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | IMPL_DEF | 8232 | STRUCT_DEF | UNION_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | IMPL_DEF |
7272 | | USE_ITEM | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE | MACRO_CALL => true, | 8233 | | USE_ITEM | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE | MACRO_CALL |
8234 | | EXTERN_BLOCK => true, | ||
7273 | _ => false, | 8235 | _ => false, |
7274 | } | 8236 | } |
7275 | } | 8237 | } |
@@ -7288,6 +8250,7 @@ impl AstNode for ModuleItem { | |||
7288 | STATIC_DEF => ModuleItem::StaticDef(StaticDef { syntax }), | 8250 | STATIC_DEF => ModuleItem::StaticDef(StaticDef { syntax }), |
7289 | MODULE => ModuleItem::Module(Module { syntax }), | 8251 | MODULE => ModuleItem::Module(Module { syntax }), |
7290 | MACRO_CALL => ModuleItem::MacroCall(MacroCall { syntax }), | 8252 | MACRO_CALL => ModuleItem::MacroCall(MacroCall { syntax }), |
8253 | EXTERN_BLOCK => ModuleItem::ExternBlock(ExternBlock { syntax }), | ||
7291 | _ => return None, | 8254 | _ => return None, |
7292 | }; | 8255 | }; |
7293 | Some(res) | 8256 | Some(res) |
@@ -7307,9 +8270,11 @@ impl AstNode for ModuleItem { | |||
7307 | ModuleItem::StaticDef(it) => &it.syntax, | 8270 | ModuleItem::StaticDef(it) => &it.syntax, |
7308 | ModuleItem::Module(it) => &it.syntax, | 8271 | ModuleItem::Module(it) => &it.syntax, |
7309 | ModuleItem::MacroCall(it) => &it.syntax, | 8272 | ModuleItem::MacroCall(it) => &it.syntax, |
8273 | ModuleItem::ExternBlock(it) => &it.syntax, | ||
7310 | } | 8274 | } |
7311 | } | 8275 | } |
7312 | } | 8276 | } |
8277 | impl ast::NameOwner for ModuleItem {} | ||
7313 | impl ast::AttrsOwner for ModuleItem {} | 8278 | impl ast::AttrsOwner for ModuleItem {} |
7314 | impl ast::VisibilityOwner for ModuleItem {} | 8279 | impl ast::VisibilityOwner for ModuleItem {} |
7315 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 8280 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -7362,8 +8327,54 @@ impl AstNode for ImplItem { | |||
7362 | } | 8327 | } |
7363 | } | 8328 | } |
7364 | } | 8329 | } |
8330 | impl ast::NameOwner for ImplItem {} | ||
7365 | impl ast::AttrsOwner for ImplItem {} | 8331 | impl ast::AttrsOwner for ImplItem {} |
7366 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 8332 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
8333 | pub enum ExternItem { | ||
8334 | FnDef(FnDef), | ||
8335 | StaticDef(StaticDef), | ||
8336 | } | ||
8337 | impl From<FnDef> for ExternItem { | ||
8338 | fn from(node: FnDef) -> ExternItem { | ||
8339 | ExternItem::FnDef(node) | ||
8340 | } | ||
8341 | } | ||
8342 | impl From<StaticDef> for ExternItem { | ||
8343 | fn from(node: StaticDef) -> ExternItem { | ||
8344 | ExternItem::StaticDef(node) | ||
8345 | } | ||
8346 | } | ||
8347 | impl std::fmt::Display for ExternItem { | ||
8348 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
8349 | std::fmt::Display::fmt(self.syntax(), f) | ||
8350 | } | ||
8351 | } | ||
8352 | impl AstNode for ExternItem { | ||
8353 | fn can_cast(kind: SyntaxKind) -> bool { | ||
8354 | match kind { | ||
8355 | FN_DEF | STATIC_DEF => true, | ||
8356 | _ => false, | ||
8357 | } | ||
8358 | } | ||
8359 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
8360 | let res = match syntax.kind() { | ||
8361 | FN_DEF => ExternItem::FnDef(FnDef { syntax }), | ||
8362 | STATIC_DEF => ExternItem::StaticDef(StaticDef { syntax }), | ||
8363 | _ => return None, | ||
8364 | }; | ||
8365 | Some(res) | ||
8366 | } | ||
8367 | fn syntax(&self) -> &SyntaxNode { | ||
8368 | match self { | ||
8369 | ExternItem::FnDef(it) => &it.syntax, | ||
8370 | ExternItem::StaticDef(it) => &it.syntax, | ||
8371 | } | ||
8372 | } | ||
8373 | } | ||
8374 | impl ast::NameOwner for ExternItem {} | ||
8375 | impl ast::AttrsOwner for ExternItem {} | ||
8376 | impl ast::VisibilityOwner for ExternItem {} | ||
8377 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
7367 | pub enum Expr { | 8378 | pub enum Expr { |
7368 | TupleExpr(TupleExpr), | 8379 | TupleExpr(TupleExpr), |
7369 | ArrayExpr(ArrayExpr), | 8380 | ArrayExpr(ArrayExpr), |
@@ -7642,6 +8653,7 @@ impl AstNode for Expr { | |||
7642 | } | 8653 | } |
7643 | } | 8654 | } |
7644 | } | 8655 | } |
8656 | impl ast::AttrsOwner for Expr {} | ||
7645 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 8657 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
7646 | pub enum Pat { | 8658 | pub enum Pat { |
7647 | OrPat(OrPat), | 8659 | OrPat(OrPat), |
@@ -7791,6 +8803,48 @@ impl AstNode for Pat { | |||
7791 | } | 8803 | } |
7792 | } | 8804 | } |
7793 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 8805 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
8806 | pub enum RecordInnerPat { | ||
8807 | RecordFieldPat(RecordFieldPat), | ||
8808 | BindPat(BindPat), | ||
8809 | } | ||
8810 | impl From<RecordFieldPat> for RecordInnerPat { | ||
8811 | fn from(node: RecordFieldPat) -> RecordInnerPat { | ||
8812 | RecordInnerPat::RecordFieldPat(node) | ||
8813 | } | ||
8814 | } | ||
8815 | impl From<BindPat> for RecordInnerPat { | ||
8816 | fn from(node: BindPat) -> RecordInnerPat { | ||
8817 | RecordInnerPat::BindPat(node) | ||
8818 | } | ||
8819 | } | ||
8820 | impl std::fmt::Display for RecordInnerPat { | ||
8821 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
8822 | std::fmt::Display::fmt(self.syntax(), f) | ||
8823 | } | ||
8824 | } | ||
8825 | impl AstNode for RecordInnerPat { | ||
8826 | fn can_cast(kind: SyntaxKind) -> bool { | ||
8827 | match kind { | ||
8828 | RECORD_FIELD_PAT | BIND_PAT => true, | ||
8829 | _ => false, | ||
8830 | } | ||
8831 | } | ||
8832 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
8833 | let res = match syntax.kind() { | ||
8834 | RECORD_FIELD_PAT => RecordInnerPat::RecordFieldPat(RecordFieldPat { syntax }), | ||
8835 | BIND_PAT => RecordInnerPat::BindPat(BindPat { syntax }), | ||
8836 | _ => return None, | ||
8837 | }; | ||
8838 | Some(res) | ||
8839 | } | ||
8840 | fn syntax(&self) -> &SyntaxNode { | ||
8841 | match self { | ||
8842 | RecordInnerPat::RecordFieldPat(it) => &it.syntax, | ||
8843 | RecordInnerPat::BindPat(it) => &it.syntax, | ||
8844 | } | ||
8845 | } | ||
8846 | } | ||
8847 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
7794 | pub enum AttrInput { | 8848 | pub enum AttrInput { |
7795 | Literal(Literal), | 8849 | Literal(Literal), |
7796 | TokenTree(TokenTree), | 8850 | TokenTree(TokenTree), |
@@ -7834,19 +8888,19 @@ impl AstNode for AttrInput { | |||
7834 | } | 8888 | } |
7835 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 8889 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
7836 | pub enum Stmt { | 8890 | pub enum Stmt { |
7837 | ExprStmt(ExprStmt), | ||
7838 | LetStmt(LetStmt), | 8891 | LetStmt(LetStmt), |
7839 | } | 8892 | ExprStmt(ExprStmt), |
7840 | impl From<ExprStmt> for Stmt { | ||
7841 | fn from(node: ExprStmt) -> Stmt { | ||
7842 | Stmt::ExprStmt(node) | ||
7843 | } | ||
7844 | } | 8893 | } |
7845 | impl From<LetStmt> for Stmt { | 8894 | impl From<LetStmt> for Stmt { |
7846 | fn from(node: LetStmt) -> Stmt { | 8895 | fn from(node: LetStmt) -> Stmt { |
7847 | Stmt::LetStmt(node) | 8896 | Stmt::LetStmt(node) |
7848 | } | 8897 | } |
7849 | } | 8898 | } |
8899 | impl From<ExprStmt> for Stmt { | ||
8900 | fn from(node: ExprStmt) -> Stmt { | ||
8901 | Stmt::ExprStmt(node) | ||
8902 | } | ||
8903 | } | ||
7850 | impl std::fmt::Display for Stmt { | 8904 | impl std::fmt::Display for Stmt { |
7851 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | 8905 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { |
7852 | std::fmt::Display::fmt(self.syntax(), f) | 8906 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -7855,22 +8909,717 @@ impl std::fmt::Display for Stmt { | |||
7855 | impl AstNode for Stmt { | 8909 | impl AstNode for Stmt { |
7856 | fn can_cast(kind: SyntaxKind) -> bool { | 8910 | fn can_cast(kind: SyntaxKind) -> bool { |
7857 | match kind { | 8911 | match kind { |
7858 | EXPR_STMT | LET_STMT => true, | 8912 | LET_STMT | EXPR_STMT => true, |
7859 | _ => false, | 8913 | _ => false, |
7860 | } | 8914 | } |
7861 | } | 8915 | } |
7862 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 8916 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
7863 | let res = match syntax.kind() { | 8917 | let res = match syntax.kind() { |
7864 | EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }), | ||
7865 | LET_STMT => Stmt::LetStmt(LetStmt { syntax }), | 8918 | LET_STMT => Stmt::LetStmt(LetStmt { syntax }), |
8919 | EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }), | ||
7866 | _ => return None, | 8920 | _ => return None, |
7867 | }; | 8921 | }; |
7868 | Some(res) | 8922 | Some(res) |
7869 | } | 8923 | } |
7870 | fn syntax(&self) -> &SyntaxNode { | 8924 | fn syntax(&self) -> &SyntaxNode { |
7871 | match self { | 8925 | match self { |
7872 | Stmt::ExprStmt(it) => &it.syntax, | ||
7873 | Stmt::LetStmt(it) => &it.syntax, | 8926 | Stmt::LetStmt(it) => &it.syntax, |
8927 | Stmt::ExprStmt(it) => &it.syntax, | ||
8928 | } | ||
8929 | } | ||
8930 | } | ||
8931 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
8932 | pub enum LeftDelimiter { | ||
8933 | LParen(LParen), | ||
8934 | LBrack(LBrack), | ||
8935 | LCurly(LCurly), | ||
8936 | } | ||
8937 | impl From<LParen> for LeftDelimiter { | ||
8938 | fn from(node: LParen) -> LeftDelimiter { | ||
8939 | LeftDelimiter::LParen(node) | ||
8940 | } | ||
8941 | } | ||
8942 | impl From<LBrack> for LeftDelimiter { | ||
8943 | fn from(node: LBrack) -> LeftDelimiter { | ||
8944 | LeftDelimiter::LBrack(node) | ||
8945 | } | ||
8946 | } | ||
8947 | impl From<LCurly> for LeftDelimiter { | ||
8948 | fn from(node: LCurly) -> LeftDelimiter { | ||
8949 | LeftDelimiter::LCurly(node) | ||
8950 | } | ||
8951 | } | ||
8952 | impl std::fmt::Display for LeftDelimiter { | ||
8953 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
8954 | std::fmt::Display::fmt(self.syntax(), f) | ||
8955 | } | ||
8956 | } | ||
8957 | impl AstToken for LeftDelimiter { | ||
8958 | fn can_cast(kind: SyntaxKind) -> bool { | ||
8959 | match kind { | ||
8960 | L_PAREN | L_BRACK | L_CURLY => true, | ||
8961 | _ => false, | ||
8962 | } | ||
8963 | } | ||
8964 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
8965 | let res = match syntax.kind() { | ||
8966 | L_PAREN => LeftDelimiter::LParen(LParen { syntax }), | ||
8967 | L_BRACK => LeftDelimiter::LBrack(LBrack { syntax }), | ||
8968 | L_CURLY => LeftDelimiter::LCurly(LCurly { syntax }), | ||
8969 | _ => return None, | ||
8970 | }; | ||
8971 | Some(res) | ||
8972 | } | ||
8973 | fn syntax(&self) -> &SyntaxToken { | ||
8974 | match self { | ||
8975 | LeftDelimiter::LParen(it) => &it.syntax, | ||
8976 | LeftDelimiter::LBrack(it) => &it.syntax, | ||
8977 | LeftDelimiter::LCurly(it) => &it.syntax, | ||
8978 | } | ||
8979 | } | ||
8980 | } | ||
8981 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
8982 | pub enum RightDelimiter { | ||
8983 | RParen(RParen), | ||
8984 | RBrack(RBrack), | ||
8985 | RCurly(RCurly), | ||
8986 | } | ||
8987 | impl From<RParen> for RightDelimiter { | ||
8988 | fn from(node: RParen) -> RightDelimiter { | ||
8989 | RightDelimiter::RParen(node) | ||
8990 | } | ||
8991 | } | ||
8992 | impl From<RBrack> for RightDelimiter { | ||
8993 | fn from(node: RBrack) -> RightDelimiter { | ||
8994 | RightDelimiter::RBrack(node) | ||
8995 | } | ||
8996 | } | ||
8997 | impl From<RCurly> for RightDelimiter { | ||
8998 | fn from(node: RCurly) -> RightDelimiter { | ||
8999 | RightDelimiter::RCurly(node) | ||
9000 | } | ||
9001 | } | ||
9002 | impl std::fmt::Display for RightDelimiter { | ||
9003 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
9004 | std::fmt::Display::fmt(self.syntax(), f) | ||
9005 | } | ||
9006 | } | ||
9007 | impl AstToken for RightDelimiter { | ||
9008 | fn can_cast(kind: SyntaxKind) -> bool { | ||
9009 | match kind { | ||
9010 | R_PAREN | R_BRACK | R_CURLY => true, | ||
9011 | _ => false, | ||
9012 | } | ||
9013 | } | ||
9014 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
9015 | let res = match syntax.kind() { | ||
9016 | R_PAREN => RightDelimiter::RParen(RParen { syntax }), | ||
9017 | R_BRACK => RightDelimiter::RBrack(RBrack { syntax }), | ||
9018 | R_CURLY => RightDelimiter::RCurly(RCurly { syntax }), | ||
9019 | _ => return None, | ||
9020 | }; | ||
9021 | Some(res) | ||
9022 | } | ||
9023 | fn syntax(&self) -> &SyntaxToken { | ||
9024 | match self { | ||
9025 | RightDelimiter::RParen(it) => &it.syntax, | ||
9026 | RightDelimiter::RBrack(it) => &it.syntax, | ||
9027 | RightDelimiter::RCurly(it) => &it.syntax, | ||
9028 | } | ||
9029 | } | ||
9030 | } | ||
9031 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
9032 | pub enum RangeSeparator { | ||
9033 | Dotdot(Dotdot), | ||
9034 | Dotdotdot(Dotdotdot), | ||
9035 | Dotdoteq(Dotdoteq), | ||
9036 | } | ||
9037 | impl From<Dotdot> for RangeSeparator { | ||
9038 | fn from(node: Dotdot) -> RangeSeparator { | ||
9039 | RangeSeparator::Dotdot(node) | ||
9040 | } | ||
9041 | } | ||
9042 | impl From<Dotdotdot> for RangeSeparator { | ||
9043 | fn from(node: Dotdotdot) -> RangeSeparator { | ||
9044 | RangeSeparator::Dotdotdot(node) | ||
9045 | } | ||
9046 | } | ||
9047 | impl From<Dotdoteq> for RangeSeparator { | ||
9048 | fn from(node: Dotdoteq) -> RangeSeparator { | ||
9049 | RangeSeparator::Dotdoteq(node) | ||
9050 | } | ||
9051 | } | ||
9052 | impl std::fmt::Display for RangeSeparator { | ||
9053 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
9054 | std::fmt::Display::fmt(self.syntax(), f) | ||
9055 | } | ||
9056 | } | ||
9057 | impl AstToken for RangeSeparator { | ||
9058 | fn can_cast(kind: SyntaxKind) -> bool { | ||
9059 | match kind { | ||
9060 | DOTDOT | DOTDOTDOT | DOTDOTEQ => true, | ||
9061 | _ => false, | ||
9062 | } | ||
9063 | } | ||
9064 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
9065 | let res = match syntax.kind() { | ||
9066 | DOTDOT => RangeSeparator::Dotdot(Dotdot { syntax }), | ||
9067 | DOTDOTDOT => RangeSeparator::Dotdotdot(Dotdotdot { syntax }), | ||
9068 | DOTDOTEQ => RangeSeparator::Dotdoteq(Dotdoteq { syntax }), | ||
9069 | _ => return None, | ||
9070 | }; | ||
9071 | Some(res) | ||
9072 | } | ||
9073 | fn syntax(&self) -> &SyntaxToken { | ||
9074 | match self { | ||
9075 | RangeSeparator::Dotdot(it) => &it.syntax, | ||
9076 | RangeSeparator::Dotdotdot(it) => &it.syntax, | ||
9077 | RangeSeparator::Dotdoteq(it) => &it.syntax, | ||
9078 | } | ||
9079 | } | ||
9080 | } | ||
9081 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
9082 | pub enum BinOp { | ||
9083 | Pipepipe(Pipepipe), | ||
9084 | Ampamp(Ampamp), | ||
9085 | Eqeq(Eqeq), | ||
9086 | Neq(Neq), | ||
9087 | Lteq(Lteq), | ||
9088 | Gteq(Gteq), | ||
9089 | LAngle(LAngle), | ||
9090 | RAngle(RAngle), | ||
9091 | Plus(Plus), | ||
9092 | Star(Star), | ||
9093 | Minus(Minus), | ||
9094 | Slash(Slash), | ||
9095 | Percent(Percent), | ||
9096 | Shl(Shl), | ||
9097 | Shr(Shr), | ||
9098 | Caret(Caret), | ||
9099 | Pipe(Pipe), | ||
9100 | Amp(Amp), | ||
9101 | Eq(Eq), | ||
9102 | Pluseq(Pluseq), | ||
9103 | Slasheq(Slasheq), | ||
9104 | Stareq(Stareq), | ||
9105 | Percenteq(Percenteq), | ||
9106 | Shreq(Shreq), | ||
9107 | Shleq(Shleq), | ||
9108 | Minuseq(Minuseq), | ||
9109 | Pipeeq(Pipeeq), | ||
9110 | Ampeq(Ampeq), | ||
9111 | Careteq(Careteq), | ||
9112 | } | ||
9113 | impl From<Pipepipe> for BinOp { | ||
9114 | fn from(node: Pipepipe) -> BinOp { | ||
9115 | BinOp::Pipepipe(node) | ||
9116 | } | ||
9117 | } | ||
9118 | impl From<Ampamp> for BinOp { | ||
9119 | fn from(node: Ampamp) -> BinOp { | ||
9120 | BinOp::Ampamp(node) | ||
9121 | } | ||
9122 | } | ||
9123 | impl From<Eqeq> for BinOp { | ||
9124 | fn from(node: Eqeq) -> BinOp { | ||
9125 | BinOp::Eqeq(node) | ||
9126 | } | ||
9127 | } | ||
9128 | impl From<Neq> for BinOp { | ||
9129 | fn from(node: Neq) -> BinOp { | ||
9130 | BinOp::Neq(node) | ||
9131 | } | ||
9132 | } | ||
9133 | impl From<Lteq> for BinOp { | ||
9134 | fn from(node: Lteq) -> BinOp { | ||
9135 | BinOp::Lteq(node) | ||
9136 | } | ||
9137 | } | ||
9138 | impl From<Gteq> for BinOp { | ||
9139 | fn from(node: Gteq) -> BinOp { | ||
9140 | BinOp::Gteq(node) | ||
9141 | } | ||
9142 | } | ||
9143 | impl From<LAngle> for BinOp { | ||
9144 | fn from(node: LAngle) -> BinOp { | ||
9145 | BinOp::LAngle(node) | ||
9146 | } | ||
9147 | } | ||
9148 | impl From<RAngle> for BinOp { | ||
9149 | fn from(node: RAngle) -> BinOp { | ||
9150 | BinOp::RAngle(node) | ||
9151 | } | ||
9152 | } | ||
9153 | impl From<Plus> for BinOp { | ||
9154 | fn from(node: Plus) -> BinOp { | ||
9155 | BinOp::Plus(node) | ||
9156 | } | ||
9157 | } | ||
9158 | impl From<Star> for BinOp { | ||
9159 | fn from(node: Star) -> BinOp { | ||
9160 | BinOp::Star(node) | ||
9161 | } | ||
9162 | } | ||
9163 | impl From<Minus> for BinOp { | ||
9164 | fn from(node: Minus) -> BinOp { | ||
9165 | BinOp::Minus(node) | ||
9166 | } | ||
9167 | } | ||
9168 | impl From<Slash> for BinOp { | ||
9169 | fn from(node: Slash) -> BinOp { | ||
9170 | BinOp::Slash(node) | ||
9171 | } | ||
9172 | } | ||
9173 | impl From<Percent> for BinOp { | ||
9174 | fn from(node: Percent) -> BinOp { | ||
9175 | BinOp::Percent(node) | ||
9176 | } | ||
9177 | } | ||
9178 | impl From<Shl> for BinOp { | ||
9179 | fn from(node: Shl) -> BinOp { | ||
9180 | BinOp::Shl(node) | ||
9181 | } | ||
9182 | } | ||
9183 | impl From<Shr> for BinOp { | ||
9184 | fn from(node: Shr) -> BinOp { | ||
9185 | BinOp::Shr(node) | ||
9186 | } | ||
9187 | } | ||
9188 | impl From<Caret> for BinOp { | ||
9189 | fn from(node: Caret) -> BinOp { | ||
9190 | BinOp::Caret(node) | ||
9191 | } | ||
9192 | } | ||
9193 | impl From<Pipe> for BinOp { | ||
9194 | fn from(node: Pipe) -> BinOp { | ||
9195 | BinOp::Pipe(node) | ||
9196 | } | ||
9197 | } | ||
9198 | impl From<Amp> for BinOp { | ||
9199 | fn from(node: Amp) -> BinOp { | ||
9200 | BinOp::Amp(node) | ||
9201 | } | ||
9202 | } | ||
9203 | impl From<Eq> for BinOp { | ||
9204 | fn from(node: Eq) -> BinOp { | ||
9205 | BinOp::Eq(node) | ||
9206 | } | ||
9207 | } | ||
9208 | impl From<Pluseq> for BinOp { | ||
9209 | fn from(node: Pluseq) -> BinOp { | ||
9210 | BinOp::Pluseq(node) | ||
9211 | } | ||
9212 | } | ||
9213 | impl From<Slasheq> for BinOp { | ||
9214 | fn from(node: Slasheq) -> BinOp { | ||
9215 | BinOp::Slasheq(node) | ||
9216 | } | ||
9217 | } | ||
9218 | impl From<Stareq> for BinOp { | ||
9219 | fn from(node: Stareq) -> BinOp { | ||
9220 | BinOp::Stareq(node) | ||
9221 | } | ||
9222 | } | ||
9223 | impl From<Percenteq> for BinOp { | ||
9224 | fn from(node: Percenteq) -> BinOp { | ||
9225 | BinOp::Percenteq(node) | ||
9226 | } | ||
9227 | } | ||
9228 | impl From<Shreq> for BinOp { | ||
9229 | fn from(node: Shreq) -> BinOp { | ||
9230 | BinOp::Shreq(node) | ||
9231 | } | ||
9232 | } | ||
9233 | impl From<Shleq> for BinOp { | ||
9234 | fn from(node: Shleq) -> BinOp { | ||
9235 | BinOp::Shleq(node) | ||
9236 | } | ||
9237 | } | ||
9238 | impl From<Minuseq> for BinOp { | ||
9239 | fn from(node: Minuseq) -> BinOp { | ||
9240 | BinOp::Minuseq(node) | ||
9241 | } | ||
9242 | } | ||
9243 | impl From<Pipeeq> for BinOp { | ||
9244 | fn from(node: Pipeeq) -> BinOp { | ||
9245 | BinOp::Pipeeq(node) | ||
9246 | } | ||
9247 | } | ||
9248 | impl From<Ampeq> for BinOp { | ||
9249 | fn from(node: Ampeq) -> BinOp { | ||
9250 | BinOp::Ampeq(node) | ||
9251 | } | ||
9252 | } | ||
9253 | impl From<Careteq> for BinOp { | ||
9254 | fn from(node: Careteq) -> BinOp { | ||
9255 | BinOp::Careteq(node) | ||
9256 | } | ||
9257 | } | ||
9258 | impl std::fmt::Display for BinOp { | ||
9259 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
9260 | std::fmt::Display::fmt(self.syntax(), f) | ||
9261 | } | ||
9262 | } | ||
9263 | impl AstToken for BinOp { | ||
9264 | fn can_cast(kind: SyntaxKind) -> bool { | ||
9265 | match kind { | ||
9266 | PIPEPIPE | AMPAMP | EQEQ | NEQ | LTEQ | GTEQ | L_ANGLE | R_ANGLE | PLUS | STAR | ||
9267 | | MINUS | SLASH | PERCENT | SHL | SHR | CARET | PIPE | AMP | EQ | PLUSEQ | SLASHEQ | ||
9268 | | STAREQ | PERCENTEQ | SHREQ | SHLEQ | MINUSEQ | PIPEEQ | AMPEQ | CARETEQ => true, | ||
9269 | _ => false, | ||
9270 | } | ||
9271 | } | ||
9272 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
9273 | let res = match syntax.kind() { | ||
9274 | PIPEPIPE => BinOp::Pipepipe(Pipepipe { syntax }), | ||
9275 | AMPAMP => BinOp::Ampamp(Ampamp { syntax }), | ||
9276 | EQEQ => BinOp::Eqeq(Eqeq { syntax }), | ||
9277 | NEQ => BinOp::Neq(Neq { syntax }), | ||
9278 | LTEQ => BinOp::Lteq(Lteq { syntax }), | ||
9279 | GTEQ => BinOp::Gteq(Gteq { syntax }), | ||
9280 | L_ANGLE => BinOp::LAngle(LAngle { syntax }), | ||
9281 | R_ANGLE => BinOp::RAngle(RAngle { syntax }), | ||
9282 | PLUS => BinOp::Plus(Plus { syntax }), | ||
9283 | STAR => BinOp::Star(Star { syntax }), | ||
9284 | MINUS => BinOp::Minus(Minus { syntax }), | ||
9285 | SLASH => BinOp::Slash(Slash { syntax }), | ||
9286 | PERCENT => BinOp::Percent(Percent { syntax }), | ||
9287 | SHL => BinOp::Shl(Shl { syntax }), | ||
9288 | SHR => BinOp::Shr(Shr { syntax }), | ||
9289 | CARET => BinOp::Caret(Caret { syntax }), | ||
9290 | PIPE => BinOp::Pipe(Pipe { syntax }), | ||
9291 | AMP => BinOp::Amp(Amp { syntax }), | ||
9292 | EQ => BinOp::Eq(Eq { syntax }), | ||
9293 | PLUSEQ => BinOp::Pluseq(Pluseq { syntax }), | ||
9294 | SLASHEQ => BinOp::Slasheq(Slasheq { syntax }), | ||
9295 | STAREQ => BinOp::Stareq(Stareq { syntax }), | ||
9296 | PERCENTEQ => BinOp::Percenteq(Percenteq { syntax }), | ||
9297 | SHREQ => BinOp::Shreq(Shreq { syntax }), | ||
9298 | SHLEQ => BinOp::Shleq(Shleq { syntax }), | ||
9299 | MINUSEQ => BinOp::Minuseq(Minuseq { syntax }), | ||
9300 | PIPEEQ => BinOp::Pipeeq(Pipeeq { syntax }), | ||
9301 | AMPEQ => BinOp::Ampeq(Ampeq { syntax }), | ||
9302 | CARETEQ => BinOp::Careteq(Careteq { syntax }), | ||
9303 | _ => return None, | ||
9304 | }; | ||
9305 | Some(res) | ||
9306 | } | ||
9307 | fn syntax(&self) -> &SyntaxToken { | ||
9308 | match self { | ||
9309 | BinOp::Pipepipe(it) => &it.syntax, | ||
9310 | BinOp::Ampamp(it) => &it.syntax, | ||
9311 | BinOp::Eqeq(it) => &it.syntax, | ||
9312 | BinOp::Neq(it) => &it.syntax, | ||
9313 | BinOp::Lteq(it) => &it.syntax, | ||
9314 | BinOp::Gteq(it) => &it.syntax, | ||
9315 | BinOp::LAngle(it) => &it.syntax, | ||
9316 | BinOp::RAngle(it) => &it.syntax, | ||
9317 | BinOp::Plus(it) => &it.syntax, | ||
9318 | BinOp::Star(it) => &it.syntax, | ||
9319 | BinOp::Minus(it) => &it.syntax, | ||
9320 | BinOp::Slash(it) => &it.syntax, | ||
9321 | BinOp::Percent(it) => &it.syntax, | ||
9322 | BinOp::Shl(it) => &it.syntax, | ||
9323 | BinOp::Shr(it) => &it.syntax, | ||
9324 | BinOp::Caret(it) => &it.syntax, | ||
9325 | BinOp::Pipe(it) => &it.syntax, | ||
9326 | BinOp::Amp(it) => &it.syntax, | ||
9327 | BinOp::Eq(it) => &it.syntax, | ||
9328 | BinOp::Pluseq(it) => &it.syntax, | ||
9329 | BinOp::Slasheq(it) => &it.syntax, | ||
9330 | BinOp::Stareq(it) => &it.syntax, | ||
9331 | BinOp::Percenteq(it) => &it.syntax, | ||
9332 | BinOp::Shreq(it) => &it.syntax, | ||
9333 | BinOp::Shleq(it) => &it.syntax, | ||
9334 | BinOp::Minuseq(it) => &it.syntax, | ||
9335 | BinOp::Pipeeq(it) => &it.syntax, | ||
9336 | BinOp::Ampeq(it) => &it.syntax, | ||
9337 | BinOp::Careteq(it) => &it.syntax, | ||
9338 | } | ||
9339 | } | ||
9340 | } | ||
9341 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
9342 | pub enum PrefixOp { | ||
9343 | Minus(Minus), | ||
9344 | Excl(Excl), | ||
9345 | Star(Star), | ||
9346 | } | ||
9347 | impl From<Minus> for PrefixOp { | ||
9348 | fn from(node: Minus) -> PrefixOp { | ||
9349 | PrefixOp::Minus(node) | ||
9350 | } | ||
9351 | } | ||
9352 | impl From<Excl> for PrefixOp { | ||
9353 | fn from(node: Excl) -> PrefixOp { | ||
9354 | PrefixOp::Excl(node) | ||
9355 | } | ||
9356 | } | ||
9357 | impl From<Star> for PrefixOp { | ||
9358 | fn from(node: Star) -> PrefixOp { | ||
9359 | PrefixOp::Star(node) | ||
9360 | } | ||
9361 | } | ||
9362 | impl std::fmt::Display for PrefixOp { | ||
9363 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
9364 | std::fmt::Display::fmt(self.syntax(), f) | ||
9365 | } | ||
9366 | } | ||
9367 | impl AstToken for PrefixOp { | ||
9368 | fn can_cast(kind: SyntaxKind) -> bool { | ||
9369 | match kind { | ||
9370 | MINUS | EXCL | STAR => true, | ||
9371 | _ => false, | ||
9372 | } | ||
9373 | } | ||
9374 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
9375 | let res = match syntax.kind() { | ||
9376 | MINUS => PrefixOp::Minus(Minus { syntax }), | ||
9377 | EXCL => PrefixOp::Excl(Excl { syntax }), | ||
9378 | STAR => PrefixOp::Star(Star { syntax }), | ||
9379 | _ => return None, | ||
9380 | }; | ||
9381 | Some(res) | ||
9382 | } | ||
9383 | fn syntax(&self) -> &SyntaxToken { | ||
9384 | match self { | ||
9385 | PrefixOp::Minus(it) => &it.syntax, | ||
9386 | PrefixOp::Excl(it) => &it.syntax, | ||
9387 | PrefixOp::Star(it) => &it.syntax, | ||
9388 | } | ||
9389 | } | ||
9390 | } | ||
9391 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
9392 | pub enum RangeOp { | ||
9393 | Dotdot(Dotdot), | ||
9394 | Dotdoteq(Dotdoteq), | ||
9395 | } | ||
9396 | impl From<Dotdot> for RangeOp { | ||
9397 | fn from(node: Dotdot) -> RangeOp { | ||
9398 | RangeOp::Dotdot(node) | ||
9399 | } | ||
9400 | } | ||
9401 | impl From<Dotdoteq> for RangeOp { | ||
9402 | fn from(node: Dotdoteq) -> RangeOp { | ||
9403 | RangeOp::Dotdoteq(node) | ||
9404 | } | ||
9405 | } | ||
9406 | impl std::fmt::Display for RangeOp { | ||
9407 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
9408 | std::fmt::Display::fmt(self.syntax(), f) | ||
9409 | } | ||
9410 | } | ||
9411 | impl AstToken for RangeOp { | ||
9412 | fn can_cast(kind: SyntaxKind) -> bool { | ||
9413 | match kind { | ||
9414 | DOTDOT | DOTDOTEQ => true, | ||
9415 | _ => false, | ||
9416 | } | ||
9417 | } | ||
9418 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
9419 | let res = match syntax.kind() { | ||
9420 | DOTDOT => RangeOp::Dotdot(Dotdot { syntax }), | ||
9421 | DOTDOTEQ => RangeOp::Dotdoteq(Dotdoteq { syntax }), | ||
9422 | _ => return None, | ||
9423 | }; | ||
9424 | Some(res) | ||
9425 | } | ||
9426 | fn syntax(&self) -> &SyntaxToken { | ||
9427 | match self { | ||
9428 | RangeOp::Dotdot(it) => &it.syntax, | ||
9429 | RangeOp::Dotdoteq(it) => &it.syntax, | ||
9430 | } | ||
9431 | } | ||
9432 | } | ||
9433 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
9434 | pub enum LiteralToken { | ||
9435 | IntNumber(IntNumber), | ||
9436 | FloatNumber(FloatNumber), | ||
9437 | String(String), | ||
9438 | RawString(RawString), | ||
9439 | TrueKw(TrueKw), | ||
9440 | FalseKw(FalseKw), | ||
9441 | ByteString(ByteString), | ||
9442 | RawByteString(RawByteString), | ||
9443 | Char(Char), | ||
9444 | Byte(Byte), | ||
9445 | } | ||
9446 | impl From<IntNumber> for LiteralToken { | ||
9447 | fn from(node: IntNumber) -> LiteralToken { | ||
9448 | LiteralToken::IntNumber(node) | ||
9449 | } | ||
9450 | } | ||
9451 | impl From<FloatNumber> for LiteralToken { | ||
9452 | fn from(node: FloatNumber) -> LiteralToken { | ||
9453 | LiteralToken::FloatNumber(node) | ||
9454 | } | ||
9455 | } | ||
9456 | impl From<String> for LiteralToken { | ||
9457 | fn from(node: String) -> LiteralToken { | ||
9458 | LiteralToken::String(node) | ||
9459 | } | ||
9460 | } | ||
9461 | impl From<RawString> for LiteralToken { | ||
9462 | fn from(node: RawString) -> LiteralToken { | ||
9463 | LiteralToken::RawString(node) | ||
9464 | } | ||
9465 | } | ||
9466 | impl From<TrueKw> for LiteralToken { | ||
9467 | fn from(node: TrueKw) -> LiteralToken { | ||
9468 | LiteralToken::TrueKw(node) | ||
9469 | } | ||
9470 | } | ||
9471 | impl From<FalseKw> for LiteralToken { | ||
9472 | fn from(node: FalseKw) -> LiteralToken { | ||
9473 | LiteralToken::FalseKw(node) | ||
9474 | } | ||
9475 | } | ||
9476 | impl From<ByteString> for LiteralToken { | ||
9477 | fn from(node: ByteString) -> LiteralToken { | ||
9478 | LiteralToken::ByteString(node) | ||
9479 | } | ||
9480 | } | ||
9481 | impl From<RawByteString> for LiteralToken { | ||
9482 | fn from(node: RawByteString) -> LiteralToken { | ||
9483 | LiteralToken::RawByteString(node) | ||
9484 | } | ||
9485 | } | ||
9486 | impl From<Char> for LiteralToken { | ||
9487 | fn from(node: Char) -> LiteralToken { | ||
9488 | LiteralToken::Char(node) | ||
9489 | } | ||
9490 | } | ||
9491 | impl From<Byte> for LiteralToken { | ||
9492 | fn from(node: Byte) -> LiteralToken { | ||
9493 | LiteralToken::Byte(node) | ||
9494 | } | ||
9495 | } | ||
9496 | impl std::fmt::Display for LiteralToken { | ||
9497 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
9498 | std::fmt::Display::fmt(self.syntax(), f) | ||
9499 | } | ||
9500 | } | ||
9501 | impl AstToken for LiteralToken { | ||
9502 | fn can_cast(kind: SyntaxKind) -> bool { | ||
9503 | match kind { | ||
9504 | INT_NUMBER | FLOAT_NUMBER | STRING | RAW_STRING | TRUE_KW | FALSE_KW | BYTE_STRING | ||
9505 | | RAW_BYTE_STRING | CHAR | BYTE => true, | ||
9506 | _ => false, | ||
9507 | } | ||
9508 | } | ||
9509 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
9510 | let res = match syntax.kind() { | ||
9511 | INT_NUMBER => LiteralToken::IntNumber(IntNumber { syntax }), | ||
9512 | FLOAT_NUMBER => LiteralToken::FloatNumber(FloatNumber { syntax }), | ||
9513 | STRING => LiteralToken::String(String { syntax }), | ||
9514 | RAW_STRING => LiteralToken::RawString(RawString { syntax }), | ||
9515 | TRUE_KW => LiteralToken::TrueKw(TrueKw { syntax }), | ||
9516 | FALSE_KW => LiteralToken::FalseKw(FalseKw { syntax }), | ||
9517 | BYTE_STRING => LiteralToken::ByteString(ByteString { syntax }), | ||
9518 | RAW_BYTE_STRING => LiteralToken::RawByteString(RawByteString { syntax }), | ||
9519 | CHAR => LiteralToken::Char(Char { syntax }), | ||
9520 | BYTE => LiteralToken::Byte(Byte { syntax }), | ||
9521 | _ => return None, | ||
9522 | }; | ||
9523 | Some(res) | ||
9524 | } | ||
9525 | fn syntax(&self) -> &SyntaxToken { | ||
9526 | match self { | ||
9527 | LiteralToken::IntNumber(it) => &it.syntax, | ||
9528 | LiteralToken::FloatNumber(it) => &it.syntax, | ||
9529 | LiteralToken::String(it) => &it.syntax, | ||
9530 | LiteralToken::RawString(it) => &it.syntax, | ||
9531 | LiteralToken::TrueKw(it) => &it.syntax, | ||
9532 | LiteralToken::FalseKw(it) => &it.syntax, | ||
9533 | LiteralToken::ByteString(it) => &it.syntax, | ||
9534 | LiteralToken::RawByteString(it) => &it.syntax, | ||
9535 | LiteralToken::Char(it) => &it.syntax, | ||
9536 | LiteralToken::Byte(it) => &it.syntax, | ||
9537 | } | ||
9538 | } | ||
9539 | } | ||
9540 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
9541 | pub enum NameRefToken { | ||
9542 | Ident(Ident), | ||
9543 | IntNumber(IntNumber), | ||
9544 | } | ||
9545 | impl From<Ident> for NameRefToken { | ||
9546 | fn from(node: Ident) -> NameRefToken { | ||
9547 | NameRefToken::Ident(node) | ||
9548 | } | ||
9549 | } | ||
9550 | impl From<IntNumber> for NameRefToken { | ||
9551 | fn from(node: IntNumber) -> NameRefToken { | ||
9552 | NameRefToken::IntNumber(node) | ||
9553 | } | ||
9554 | } | ||
9555 | impl std::fmt::Display for NameRefToken { | ||
9556 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
9557 | std::fmt::Display::fmt(self.syntax(), f) | ||
9558 | } | ||
9559 | } | ||
9560 | impl AstToken for NameRefToken { | ||
9561 | fn can_cast(kind: SyntaxKind) -> bool { | ||
9562 | match kind { | ||
9563 | IDENT | INT_NUMBER => true, | ||
9564 | _ => false, | ||
9565 | } | ||
9566 | } | ||
9567 | fn cast(syntax: SyntaxToken) -> Option<Self> { | ||
9568 | let res = match syntax.kind() { | ||
9569 | IDENT => NameRefToken::Ident(Ident { syntax }), | ||
9570 | INT_NUMBER => NameRefToken::IntNumber(IntNumber { syntax }), | ||
9571 | _ => return None, | ||
9572 | }; | ||
9573 | Some(res) | ||
9574 | } | ||
9575 | fn syntax(&self) -> &SyntaxToken { | ||
9576 | match self { | ||
9577 | NameRefToken::Ident(it) => &it.syntax, | ||
9578 | NameRefToken::IntNumber(it) => &it.syntax, | ||
9579 | } | ||
9580 | } | ||
9581 | } | ||
9582 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
9583 | pub enum FieldDefList { | ||
9584 | RecordFieldDefList(RecordFieldDefList), | ||
9585 | TupleFieldDefList(TupleFieldDefList), | ||
9586 | } | ||
9587 | impl From<RecordFieldDefList> for FieldDefList { | ||
9588 | fn from(node: RecordFieldDefList) -> FieldDefList { | ||
9589 | FieldDefList::RecordFieldDefList(node) | ||
9590 | } | ||
9591 | } | ||
9592 | impl From<TupleFieldDefList> for FieldDefList { | ||
9593 | fn from(node: TupleFieldDefList) -> FieldDefList { | ||
9594 | FieldDefList::TupleFieldDefList(node) | ||
9595 | } | ||
9596 | } | ||
9597 | impl std::fmt::Display for FieldDefList { | ||
9598 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
9599 | std::fmt::Display::fmt(self.syntax(), f) | ||
9600 | } | ||
9601 | } | ||
9602 | impl AstNode for FieldDefList { | ||
9603 | fn can_cast(kind: SyntaxKind) -> bool { | ||
9604 | match kind { | ||
9605 | RECORD_FIELD_DEF_LIST | TUPLE_FIELD_DEF_LIST => true, | ||
9606 | _ => false, | ||
9607 | } | ||
9608 | } | ||
9609 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
9610 | let res = match syntax.kind() { | ||
9611 | RECORD_FIELD_DEF_LIST => { | ||
9612 | FieldDefList::RecordFieldDefList(RecordFieldDefList { syntax }) | ||
9613 | } | ||
9614 | TUPLE_FIELD_DEF_LIST => FieldDefList::TupleFieldDefList(TupleFieldDefList { syntax }), | ||
9615 | _ => return None, | ||
9616 | }; | ||
9617 | Some(res) | ||
9618 | } | ||
9619 | fn syntax(&self) -> &SyntaxNode { | ||
9620 | match self { | ||
9621 | FieldDefList::RecordFieldDefList(it) => &it.syntax, | ||
9622 | FieldDefList::TupleFieldDefList(it) => &it.syntax, | ||
7874 | } | 9623 | } |
7875 | } | 9624 | } |
7876 | } | 9625 | } |