diff options
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r-- | crates/ra_syntax/src/ast/generated.rs | 225 |
1 files changed, 218 insertions, 7 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs index 334da67ef..35a9770a6 100644 --- a/crates/ra_syntax/src/ast/generated.rs +++ b/crates/ra_syntax/src/ast/generated.rs | |||
@@ -806,7 +806,94 @@ impl<'a> ast::NameOwner<'a> for EnumDef<'a> {} | |||
806 | impl<'a> ast::TypeParamsOwner<'a> for EnumDef<'a> {} | 806 | impl<'a> ast::TypeParamsOwner<'a> for EnumDef<'a> {} |
807 | impl<'a> ast::AttrsOwner<'a> for EnumDef<'a> {} | 807 | impl<'a> ast::AttrsOwner<'a> for EnumDef<'a> {} |
808 | impl<'a> ast::DocCommentsOwner<'a> for EnumDef<'a> {} | 808 | impl<'a> ast::DocCommentsOwner<'a> for EnumDef<'a> {} |
809 | impl<'a> EnumDef<'a> {} | 809 | impl<'a> EnumDef<'a> { |
810 | pub fn variant_list(self) -> Option<EnumVariantList<'a>> { | ||
811 | super::child_opt(self) | ||
812 | } | ||
813 | } | ||
814 | |||
815 | // EnumVariant | ||
816 | #[derive(Debug, Clone, Copy,)] | ||
817 | pub struct EnumVariantNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
818 | pub(crate) syntax: SyntaxNode<R>, | ||
819 | } | ||
820 | pub type EnumVariant<'a> = EnumVariantNode<RefRoot<'a>>; | ||
821 | |||
822 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<EnumVariantNode<R1>> for EnumVariantNode<R2> { | ||
823 | fn eq(&self, other: &EnumVariantNode<R1>) -> bool { self.syntax == other.syntax } | ||
824 | } | ||
825 | impl<R: TreeRoot<RaTypes>> Eq for EnumVariantNode<R> {} | ||
826 | impl<R: TreeRoot<RaTypes>> Hash for EnumVariantNode<R> { | ||
827 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
828 | } | ||
829 | |||
830 | impl<'a> AstNode<'a> for EnumVariant<'a> { | ||
831 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
832 | match syntax.kind() { | ||
833 | ENUM_VARIANT => Some(EnumVariant { syntax }), | ||
834 | _ => None, | ||
835 | } | ||
836 | } | ||
837 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
838 | } | ||
839 | |||
840 | impl<R: TreeRoot<RaTypes>> EnumVariantNode<R> { | ||
841 | pub fn borrowed(&self) -> EnumVariant { | ||
842 | EnumVariantNode { syntax: self.syntax.borrowed() } | ||
843 | } | ||
844 | pub fn owned(&self) -> EnumVariantNode { | ||
845 | EnumVariantNode { syntax: self.syntax.owned() } | ||
846 | } | ||
847 | } | ||
848 | |||
849 | |||
850 | impl<'a> ast::NameOwner<'a> for EnumVariant<'a> {} | ||
851 | impl<'a> EnumVariant<'a> { | ||
852 | pub fn expr(self) -> Option<Expr<'a>> { | ||
853 | super::child_opt(self) | ||
854 | } | ||
855 | } | ||
856 | |||
857 | // EnumVariantList | ||
858 | #[derive(Debug, Clone, Copy,)] | ||
859 | pub struct EnumVariantListNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
860 | pub(crate) syntax: SyntaxNode<R>, | ||
861 | } | ||
862 | pub type EnumVariantList<'a> = EnumVariantListNode<RefRoot<'a>>; | ||
863 | |||
864 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<EnumVariantListNode<R1>> for EnumVariantListNode<R2> { | ||
865 | fn eq(&self, other: &EnumVariantListNode<R1>) -> bool { self.syntax == other.syntax } | ||
866 | } | ||
867 | impl<R: TreeRoot<RaTypes>> Eq for EnumVariantListNode<R> {} | ||
868 | impl<R: TreeRoot<RaTypes>> Hash for EnumVariantListNode<R> { | ||
869 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
870 | } | ||
871 | |||
872 | impl<'a> AstNode<'a> for EnumVariantList<'a> { | ||
873 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
874 | match syntax.kind() { | ||
875 | ENUM_VARIANT_LIST => Some(EnumVariantList { syntax }), | ||
876 | _ => None, | ||
877 | } | ||
878 | } | ||
879 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
880 | } | ||
881 | |||
882 | impl<R: TreeRoot<RaTypes>> EnumVariantListNode<R> { | ||
883 | pub fn borrowed(&self) -> EnumVariantList { | ||
884 | EnumVariantListNode { syntax: self.syntax.borrowed() } | ||
885 | } | ||
886 | pub fn owned(&self) -> EnumVariantListNode { | ||
887 | EnumVariantListNode { syntax: self.syntax.owned() } | ||
888 | } | ||
889 | } | ||
890 | |||
891 | |||
892 | impl<'a> EnumVariantList<'a> { | ||
893 | pub fn variants(self) -> impl Iterator<Item = EnumVariant<'a>> + 'a { | ||
894 | super::children(self) | ||
895 | } | ||
896 | } | ||
810 | 897 | ||
811 | // Expr | 898 | // Expr |
812 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] | 899 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
@@ -2189,7 +2276,52 @@ impl<R: TreeRoot<RaTypes>> NamedFieldDefNode<R> { | |||
2189 | 2276 | ||
2190 | impl<'a> ast::NameOwner<'a> for NamedFieldDef<'a> {} | 2277 | impl<'a> ast::NameOwner<'a> for NamedFieldDef<'a> {} |
2191 | impl<'a> ast::AttrsOwner<'a> for NamedFieldDef<'a> {} | 2278 | impl<'a> ast::AttrsOwner<'a> for NamedFieldDef<'a> {} |
2192 | impl<'a> NamedFieldDef<'a> {} | 2279 | impl<'a> NamedFieldDef<'a> { |
2280 | pub fn type_ref(self) -> Option<TypeRef<'a>> { | ||
2281 | super::child_opt(self) | ||
2282 | } | ||
2283 | } | ||
2284 | |||
2285 | // NamedFieldDefList | ||
2286 | #[derive(Debug, Clone, Copy,)] | ||
2287 | pub struct NamedFieldDefListNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
2288 | pub(crate) syntax: SyntaxNode<R>, | ||
2289 | } | ||
2290 | pub type NamedFieldDefList<'a> = NamedFieldDefListNode<RefRoot<'a>>; | ||
2291 | |||
2292 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NamedFieldDefListNode<R1>> for NamedFieldDefListNode<R2> { | ||
2293 | fn eq(&self, other: &NamedFieldDefListNode<R1>) -> bool { self.syntax == other.syntax } | ||
2294 | } | ||
2295 | impl<R: TreeRoot<RaTypes>> Eq for NamedFieldDefListNode<R> {} | ||
2296 | impl<R: TreeRoot<RaTypes>> Hash for NamedFieldDefListNode<R> { | ||
2297 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2298 | } | ||
2299 | |||
2300 | impl<'a> AstNode<'a> for NamedFieldDefList<'a> { | ||
2301 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
2302 | match syntax.kind() { | ||
2303 | NAMED_FIELD_DEF_LIST => Some(NamedFieldDefList { syntax }), | ||
2304 | _ => None, | ||
2305 | } | ||
2306 | } | ||
2307 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
2308 | } | ||
2309 | |||
2310 | impl<R: TreeRoot<RaTypes>> NamedFieldDefListNode<R> { | ||
2311 | pub fn borrowed(&self) -> NamedFieldDefList { | ||
2312 | NamedFieldDefListNode { syntax: self.syntax.borrowed() } | ||
2313 | } | ||
2314 | pub fn owned(&self) -> NamedFieldDefListNode { | ||
2315 | NamedFieldDefListNode { syntax: self.syntax.owned() } | ||
2316 | } | ||
2317 | } | ||
2318 | |||
2319 | |||
2320 | impl<'a> NamedFieldDefList<'a> { | ||
2321 | pub fn fields(self) -> impl Iterator<Item = NamedFieldDef<'a>> + 'a { | ||
2322 | super::children(self) | ||
2323 | } | ||
2324 | } | ||
2193 | 2325 | ||
2194 | // NamedFieldList | 2326 | // NamedFieldList |
2195 | #[derive(Debug, Clone, Copy,)] | 2327 | #[derive(Debug, Clone, Copy,)] |
@@ -2830,6 +2962,89 @@ impl<R: TreeRoot<RaTypes>> PointerTypeNode<R> { | |||
2830 | 2962 | ||
2831 | impl<'a> PointerType<'a> {} | 2963 | impl<'a> PointerType<'a> {} |
2832 | 2964 | ||
2965 | // PosField | ||
2966 | #[derive(Debug, Clone, Copy,)] | ||
2967 | pub struct PosFieldNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
2968 | pub(crate) syntax: SyntaxNode<R>, | ||
2969 | } | ||
2970 | pub type PosField<'a> = PosFieldNode<RefRoot<'a>>; | ||
2971 | |||
2972 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PosFieldNode<R1>> for PosFieldNode<R2> { | ||
2973 | fn eq(&self, other: &PosFieldNode<R1>) -> bool { self.syntax == other.syntax } | ||
2974 | } | ||
2975 | impl<R: TreeRoot<RaTypes>> Eq for PosFieldNode<R> {} | ||
2976 | impl<R: TreeRoot<RaTypes>> Hash for PosFieldNode<R> { | ||
2977 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
2978 | } | ||
2979 | |||
2980 | impl<'a> AstNode<'a> for PosField<'a> { | ||
2981 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
2982 | match syntax.kind() { | ||
2983 | POS_FIELD => Some(PosField { syntax }), | ||
2984 | _ => None, | ||
2985 | } | ||
2986 | } | ||
2987 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
2988 | } | ||
2989 | |||
2990 | impl<R: TreeRoot<RaTypes>> PosFieldNode<R> { | ||
2991 | pub fn borrowed(&self) -> PosField { | ||
2992 | PosFieldNode { syntax: self.syntax.borrowed() } | ||
2993 | } | ||
2994 | pub fn owned(&self) -> PosFieldNode { | ||
2995 | PosFieldNode { syntax: self.syntax.owned() } | ||
2996 | } | ||
2997 | } | ||
2998 | |||
2999 | |||
3000 | impl<'a> ast::AttrsOwner<'a> for PosField<'a> {} | ||
3001 | impl<'a> PosField<'a> { | ||
3002 | pub fn type_ref(self) -> Option<TypeRef<'a>> { | ||
3003 | super::child_opt(self) | ||
3004 | } | ||
3005 | } | ||
3006 | |||
3007 | // PosFieldList | ||
3008 | #[derive(Debug, Clone, Copy,)] | ||
3009 | pub struct PosFieldListNode<R: TreeRoot<RaTypes> = OwnedRoot> { | ||
3010 | pub(crate) syntax: SyntaxNode<R>, | ||
3011 | } | ||
3012 | pub type PosFieldList<'a> = PosFieldListNode<RefRoot<'a>>; | ||
3013 | |||
3014 | impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PosFieldListNode<R1>> for PosFieldListNode<R2> { | ||
3015 | fn eq(&self, other: &PosFieldListNode<R1>) -> bool { self.syntax == other.syntax } | ||
3016 | } | ||
3017 | impl<R: TreeRoot<RaTypes>> Eq for PosFieldListNode<R> {} | ||
3018 | impl<R: TreeRoot<RaTypes>> Hash for PosFieldListNode<R> { | ||
3019 | fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) } | ||
3020 | } | ||
3021 | |||
3022 | impl<'a> AstNode<'a> for PosFieldList<'a> { | ||
3023 | fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { | ||
3024 | match syntax.kind() { | ||
3025 | POS_FIELD_LIST => Some(PosFieldList { syntax }), | ||
3026 | _ => None, | ||
3027 | } | ||
3028 | } | ||
3029 | fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax } | ||
3030 | } | ||
3031 | |||
3032 | impl<R: TreeRoot<RaTypes>> PosFieldListNode<R> { | ||
3033 | pub fn borrowed(&self) -> PosFieldList { | ||
3034 | PosFieldListNode { syntax: self.syntax.borrowed() } | ||
3035 | } | ||
3036 | pub fn owned(&self) -> PosFieldListNode { | ||
3037 | PosFieldListNode { syntax: self.syntax.owned() } | ||
3038 | } | ||
3039 | } | ||
3040 | |||
3041 | |||
3042 | impl<'a> PosFieldList<'a> { | ||
3043 | pub fn fields(self) -> impl Iterator<Item = PosField<'a>> + 'a { | ||
3044 | super::children(self) | ||
3045 | } | ||
3046 | } | ||
3047 | |||
2833 | // PrefixExpr | 3048 | // PrefixExpr |
2834 | #[derive(Debug, Clone, Copy,)] | 3049 | #[derive(Debug, Clone, Copy,)] |
2835 | pub struct PrefixExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { | 3050 | pub struct PrefixExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { |
@@ -3438,11 +3653,7 @@ impl<'a> ast::NameOwner<'a> for StructDef<'a> {} | |||
3438 | impl<'a> ast::TypeParamsOwner<'a> for StructDef<'a> {} | 3653 | impl<'a> ast::TypeParamsOwner<'a> for StructDef<'a> {} |
3439 | impl<'a> ast::AttrsOwner<'a> for StructDef<'a> {} | 3654 | impl<'a> ast::AttrsOwner<'a> for StructDef<'a> {} |
3440 | impl<'a> ast::DocCommentsOwner<'a> for StructDef<'a> {} | 3655 | impl<'a> ast::DocCommentsOwner<'a> for StructDef<'a> {} |
3441 | impl<'a> StructDef<'a> { | 3656 | impl<'a> StructDef<'a> {} |
3442 | pub fn fields(self) -> impl Iterator<Item = NamedFieldDef<'a>> + 'a { | ||
3443 | super::children(self) | ||
3444 | } | ||
3445 | } | ||
3446 | 3657 | ||
3447 | // StructLit | 3658 | // StructLit |
3448 | #[derive(Debug, Clone, Copy,)] | 3659 | #[derive(Debug, Clone, Copy,)] |