@@ -78,10 +78,10 @@ impl AssocItemList {
78
78
pub struct AssocTypeArg {
79
79
pub ( crate ) syntax : SyntaxNode ,
80
80
}
81
+ impl ast:: HasGenericArgs for AssocTypeArg { }
81
82
impl ast:: HasTypeBounds for AssocTypeArg { }
82
83
impl AssocTypeArg {
83
84
pub fn const_arg ( & self ) -> Option < ConstArg > { support:: child ( & self . syntax ) }
84
- pub fn generic_arg_list ( & self ) -> Option < GenericArgList > { support:: child ( & self . syntax ) }
85
85
pub fn name_ref ( & self ) -> Option < NameRef > { support:: child ( & self . syntax ) }
86
86
pub fn param_list ( & self ) -> Option < ParamList > { support:: child ( & self . syntax ) }
87
87
pub fn ret_type ( & self ) -> Option < RetType > { support:: child ( & self . syntax ) }
@@ -783,8 +783,8 @@ pub struct MethodCallExpr {
783
783
}
784
784
impl ast:: HasArgList for MethodCallExpr { }
785
785
impl ast:: HasAttrs for MethodCallExpr { }
786
+ impl ast:: HasGenericArgs for MethodCallExpr { }
786
787
impl MethodCallExpr {
787
- pub fn generic_arg_list ( & self ) -> Option < GenericArgList > { support:: child ( & self . syntax ) }
788
788
pub fn name_ref ( & self ) -> Option < NameRef > { support:: child ( & self . syntax ) }
789
789
pub fn receiver ( & self ) -> Option < Expr > { support:: child ( & self . syntax ) }
790
790
pub fn dot_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ . ] ) }
@@ -946,8 +946,8 @@ impl PathPat {
946
946
pub struct PathSegment {
947
947
pub ( crate ) syntax : SyntaxNode ,
948
948
}
949
+ impl ast:: HasGenericArgs for PathSegment { }
949
950
impl PathSegment {
950
- pub fn generic_arg_list ( & self ) -> Option < GenericArgList > { support:: child ( & self . syntax ) }
951
951
pub fn name_ref ( & self ) -> Option < NameRef > { support:: child ( & self . syntax ) }
952
952
pub fn param_list ( & self ) -> Option < ParamList > { support:: child ( & self . syntax ) }
953
953
pub fn path_type ( & self ) -> Option < PathType > { support:: child ( & self . syntax ) }
@@ -1763,6 +1763,12 @@ pub struct AnyHasDocComments {
1763
1763
}
1764
1764
impl ast:: HasDocComments for AnyHasDocComments { }
1765
1765
1766
+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1767
+ pub struct AnyHasGenericArgs {
1768
+ pub ( crate ) syntax : SyntaxNode ,
1769
+ }
1770
+ impl ast:: HasGenericArgs for AnyHasGenericArgs { }
1771
+
1766
1772
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1767
1773
pub struct AnyHasGenericParams {
1768
1774
pub ( crate ) syntax : SyntaxNode ,
@@ -4235,6 +4241,21 @@ impl AstNode for AnyHasDocComments {
4235
4241
}
4236
4242
fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
4237
4243
}
4244
+ impl AnyHasGenericArgs {
4245
+ #[ inline]
4246
+ pub fn new < T : ast:: HasGenericArgs > ( node : T ) -> AnyHasGenericArgs {
4247
+ AnyHasGenericArgs { syntax : node. syntax ( ) . clone ( ) }
4248
+ }
4249
+ }
4250
+ impl AstNode for AnyHasGenericArgs {
4251
+ fn can_cast ( kind : SyntaxKind ) -> bool {
4252
+ matches ! ( kind, ASSOC_TYPE_ARG | METHOD_CALL_EXPR | PATH_SEGMENT )
4253
+ }
4254
+ fn cast ( syntax : SyntaxNode ) -> Option < Self > {
4255
+ Self :: can_cast ( syntax. kind ( ) ) . then_some ( AnyHasGenericArgs { syntax } )
4256
+ }
4257
+ fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
4258
+ }
4238
4259
impl AnyHasGenericParams {
4239
4260
#[ inline]
4240
4261
pub fn new < T : ast:: HasGenericParams > ( node : T ) -> AnyHasGenericParams {
0 commit comments