diff options
Diffstat (limited to 'crates/syntax')
-rw-r--r-- | crates/syntax/src/ast/generated/nodes.rs | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/crates/syntax/src/ast/generated/nodes.rs b/crates/syntax/src/ast/generated/nodes.rs index 6407d7c85..5baa54a3f 100644 --- a/crates/syntax/src/ast/generated/nodes.rs +++ b/crates/syntax/src/ast/generated/nodes.rs | |||
@@ -1072,6 +1072,13 @@ impl InferType { | |||
1072 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | 1072 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } |
1073 | } | 1073 | } |
1074 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1074 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1075 | pub struct MacroType { | ||
1076 | pub(crate) syntax: SyntaxNode, | ||
1077 | } | ||
1078 | impl MacroType { | ||
1079 | pub fn macro_call(&self) -> Option<MacroCall> { support::child(&self.syntax) } | ||
1080 | } | ||
1081 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1075 | pub struct NeverType { | 1082 | pub struct NeverType { |
1076 | pub(crate) syntax: SyntaxNode, | 1083 | pub(crate) syntax: SyntaxNode, |
1077 | } | 1084 | } |
@@ -1300,6 +1307,7 @@ pub enum Type { | |||
1300 | ForType(ForType), | 1307 | ForType(ForType), |
1301 | ImplTraitType(ImplTraitType), | 1308 | ImplTraitType(ImplTraitType), |
1302 | InferType(InferType), | 1309 | InferType(InferType), |
1310 | MacroType(MacroType), | ||
1303 | NeverType(NeverType), | 1311 | NeverType(NeverType), |
1304 | ParenType(ParenType), | 1312 | ParenType(ParenType), |
1305 | PathType(PathType), | 1313 | PathType(PathType), |
@@ -2558,6 +2566,17 @@ impl AstNode for InferType { | |||
2558 | } | 2566 | } |
2559 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2567 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2560 | } | 2568 | } |
2569 | impl AstNode for MacroType { | ||
2570 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_TYPE } | ||
2571 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2572 | if Self::can_cast(syntax.kind()) { | ||
2573 | Some(Self { syntax }) | ||
2574 | } else { | ||
2575 | None | ||
2576 | } | ||
2577 | } | ||
2578 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2579 | } | ||
2561 | impl AstNode for NeverType { | 2580 | impl AstNode for NeverType { |
2562 | fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } | 2581 | fn can_cast(kind: SyntaxKind) -> bool { kind == NEVER_TYPE } |
2563 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2582 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2889,6 +2908,9 @@ impl From<ImplTraitType> for Type { | |||
2889 | impl From<InferType> for Type { | 2908 | impl From<InferType> for Type { |
2890 | fn from(node: InferType) -> Type { Type::InferType(node) } | 2909 | fn from(node: InferType) -> Type { Type::InferType(node) } |
2891 | } | 2910 | } |
2911 | impl From<MacroType> for Type { | ||
2912 | fn from(node: MacroType) -> Type { Type::MacroType(node) } | ||
2913 | } | ||
2892 | impl From<NeverType> for Type { | 2914 | impl From<NeverType> for Type { |
2893 | fn from(node: NeverType) -> Type { Type::NeverType(node) } | 2915 | fn from(node: NeverType) -> Type { Type::NeverType(node) } |
2894 | } | 2916 | } |
@@ -2914,8 +2936,8 @@ impl AstNode for Type { | |||
2914 | fn can_cast(kind: SyntaxKind) -> bool { | 2936 | fn can_cast(kind: SyntaxKind) -> bool { |
2915 | match kind { | 2937 | match kind { |
2916 | ARRAY_TYPE | DYN_TRAIT_TYPE | FN_PTR_TYPE | FOR_TYPE | IMPL_TRAIT_TYPE | INFER_TYPE | 2938 | ARRAY_TYPE | DYN_TRAIT_TYPE | FN_PTR_TYPE | FOR_TYPE | IMPL_TRAIT_TYPE | INFER_TYPE |
2917 | | NEVER_TYPE | PAREN_TYPE | PATH_TYPE | PTR_TYPE | REF_TYPE | SLICE_TYPE | 2939 | | MACRO_TYPE | NEVER_TYPE | PAREN_TYPE | PATH_TYPE | PTR_TYPE | REF_TYPE |
2918 | | TUPLE_TYPE => true, | 2940 | | SLICE_TYPE | TUPLE_TYPE => true, |
2919 | _ => false, | 2941 | _ => false, |
2920 | } | 2942 | } |
2921 | } | 2943 | } |
@@ -2927,6 +2949,7 @@ impl AstNode for Type { | |||
2927 | FOR_TYPE => Type::ForType(ForType { syntax }), | 2949 | FOR_TYPE => Type::ForType(ForType { syntax }), |
2928 | IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), | 2950 | IMPL_TRAIT_TYPE => Type::ImplTraitType(ImplTraitType { syntax }), |
2929 | INFER_TYPE => Type::InferType(InferType { syntax }), | 2951 | INFER_TYPE => Type::InferType(InferType { syntax }), |
2952 | MACRO_TYPE => Type::MacroType(MacroType { syntax }), | ||
2930 | NEVER_TYPE => Type::NeverType(NeverType { syntax }), | 2953 | NEVER_TYPE => Type::NeverType(NeverType { syntax }), |
2931 | PAREN_TYPE => Type::ParenType(ParenType { syntax }), | 2954 | PAREN_TYPE => Type::ParenType(ParenType { syntax }), |
2932 | PATH_TYPE => Type::PathType(PathType { syntax }), | 2955 | PATH_TYPE => Type::PathType(PathType { syntax }), |
@@ -2946,6 +2969,7 @@ impl AstNode for Type { | |||
2946 | Type::ForType(it) => &it.syntax, | 2969 | Type::ForType(it) => &it.syntax, |
2947 | Type::ImplTraitType(it) => &it.syntax, | 2970 | Type::ImplTraitType(it) => &it.syntax, |
2948 | Type::InferType(it) => &it.syntax, | 2971 | Type::InferType(it) => &it.syntax, |
2972 | Type::MacroType(it) => &it.syntax, | ||
2949 | Type::NeverType(it) => &it.syntax, | 2973 | Type::NeverType(it) => &it.syntax, |
2950 | Type::ParenType(it) => &it.syntax, | 2974 | Type::ParenType(it) => &it.syntax, |
2951 | Type::PathType(it) => &it.syntax, | 2975 | Type::PathType(it) => &it.syntax, |
@@ -4082,6 +4106,11 @@ impl std::fmt::Display for InferType { | |||
4082 | std::fmt::Display::fmt(self.syntax(), f) | 4106 | std::fmt::Display::fmt(self.syntax(), f) |
4083 | } | 4107 | } |
4084 | } | 4108 | } |
4109 | impl std::fmt::Display for MacroType { | ||
4110 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4111 | std::fmt::Display::fmt(self.syntax(), f) | ||
4112 | } | ||
4113 | } | ||
4085 | impl std::fmt::Display for NeverType { | 4114 | impl std::fmt::Display for NeverType { |
4086 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4115 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4087 | std::fmt::Display::fmt(self.syntax(), f) | 4116 | std::fmt::Display::fmt(self.syntax(), f) |