@@ -3669,6 +3669,113 @@ public TypeDeclarationStatementSyntax AddTypeParameterListNames(params TypeParam
36693669 }
36703670 }
36713671
3672+ /// <summary>Represents a type function declaration statement.</summary>
3673+ /// <remarks>
3674+ /// <para>This node is associated with the following syntax kinds:</para>
3675+ /// <list type="bullet">
3676+ /// <item><description><see cref="SyntaxKind.TypeFunctionDeclarationStatement"/></description></item>
3677+ /// </list>
3678+ /// </remarks>
3679+ public sealed partial class TypeFunctionDeclarationStatementSyntax : StatementSyntax
3680+ {
3681+ private ParameterListSyntax ? parameters ;
3682+ private TypeBindingSyntax ? typeBinding ;
3683+ private StatementListSyntax ? body ;
3684+
3685+ internal TypeFunctionDeclarationStatementSyntax ( InternalSyntax . LuaSyntaxNode green , SyntaxNode ? parent , int position )
3686+ : base ( green , parent , position )
3687+ {
3688+ }
3689+
3690+ /// <summary>The 'export' keyword.</summary>
3691+ public SyntaxToken ExportKeyword
3692+ {
3693+ get
3694+ {
3695+ var slot = ( ( Syntax . InternalSyntax . TypeFunctionDeclarationStatementSyntax ) this . Green ) . exportKeyword ;
3696+ return slot != null ? new SyntaxToken ( this , slot , Position , 0 ) : default ;
3697+ }
3698+ }
3699+
3700+ /// <summary>The 'type' keyword.</summary>
3701+ public SyntaxToken TypeKeyword => new SyntaxToken ( this , ( ( Syntax . InternalSyntax . TypeFunctionDeclarationStatementSyntax ) this . Green ) . typeKeyword , GetChildPosition ( 1 ) , GetChildIndex ( 1 ) ) ;
3702+
3703+ /// <summary>The 'function' keyword.</summary>
3704+ public SyntaxToken FunctionKeyword => new SyntaxToken ( this , ( ( Syntax . InternalSyntax . TypeFunctionDeclarationStatementSyntax ) this . Green ) . functionKeyword , GetChildPosition ( 2 ) , GetChildIndex ( 2 ) ) ;
3705+
3706+ /// <summary>Represents the type function's name.</summary>
3707+ public SyntaxToken Name => new SyntaxToken ( this , ( ( Syntax . InternalSyntax . TypeFunctionDeclarationStatementSyntax ) this . Green ) . name , GetChildPosition ( 3 ) , GetChildIndex ( 3 ) ) ;
3708+
3709+ /// <summary>The parameter list.</summary>
3710+ public ParameterListSyntax Parameters => GetRed ( ref this . parameters , 4 ) ! ;
3711+
3712+ /// <summary>The function's (optional) return type.</summary>
3713+ public TypeBindingSyntax ? TypeBinding => GetRed ( ref this . typeBinding , 5 ) ;
3714+
3715+ /// <summary>The function's body.</summary>
3716+ public StatementListSyntax Body => GetRed ( ref this . body , 6 ) ! ;
3717+
3718+ /// <summary>The 'end' keyword.</summary>
3719+ public SyntaxToken EndKeyword => new SyntaxToken ( this , ( ( Syntax . InternalSyntax . TypeFunctionDeclarationStatementSyntax ) this . Green ) . endKeyword , GetChildPosition ( 7 ) , GetChildIndex ( 7 ) ) ;
3720+
3721+ /// <summary>The semicolon at the end of the statement (if any).</summary>
3722+ public override SyntaxToken SemicolonToken
3723+ {
3724+ get
3725+ {
3726+ var slot = ( ( Syntax . InternalSyntax . TypeFunctionDeclarationStatementSyntax ) this . Green ) . semicolonToken ;
3727+ return slot != null ? new SyntaxToken ( this , slot , GetChildPosition ( 8 ) , GetChildIndex ( 8 ) ) : default ;
3728+ }
3729+ }
3730+
3731+ internal override SyntaxNode ? GetNodeSlot ( int index )
3732+ => index switch
3733+ {
3734+ 4 => GetRed ( ref this . parameters , 4 ) ! ,
3735+ 5 => GetRed ( ref this . typeBinding , 5 ) ,
3736+ 6 => GetRed ( ref this . body , 6 ) ! ,
3737+ _ => null ,
3738+ } ;
3739+
3740+ internal override SyntaxNode ? GetCachedSlot ( int index )
3741+ => index switch
3742+ {
3743+ 4 => this . parameters ,
3744+ 5 => this . typeBinding ,
3745+ 6 => this . body ,
3746+ _ => null ,
3747+ } ;
3748+
3749+ public override void Accept ( LuaSyntaxVisitor visitor ) => visitor . VisitTypeFunctionDeclarationStatement ( this ) ;
3750+ public override TResult ? Accept < TResult > ( LuaSyntaxVisitor < TResult > visitor ) where TResult : default => visitor . VisitTypeFunctionDeclarationStatement ( this ) ;
3751+
3752+ public TypeFunctionDeclarationStatementSyntax Update ( SyntaxToken exportKeyword , SyntaxToken typeKeyword , SyntaxToken functionKeyword , SyntaxToken name , ParameterListSyntax parameters , TypeBindingSyntax ? typeBinding , StatementListSyntax body , SyntaxToken endKeyword , SyntaxToken semicolonToken )
3753+ {
3754+ if ( exportKeyword != this . ExportKeyword || typeKeyword != this . TypeKeyword || functionKeyword != this . FunctionKeyword || name != this . Name || parameters != this . Parameters || typeBinding != this . TypeBinding || body != this . Body || endKeyword != this . EndKeyword || semicolonToken != this . SemicolonToken )
3755+ {
3756+ var newNode = SyntaxFactory . TypeFunctionDeclarationStatement ( exportKeyword , typeKeyword , functionKeyword , name , parameters , typeBinding , body , endKeyword , semicolonToken ) ;
3757+ var annotations = GetAnnotations ( ) ;
3758+ return annotations ? . Length > 0 ? newNode . WithAnnotations ( annotations ) : newNode ;
3759+ }
3760+
3761+ return this ;
3762+ }
3763+
3764+ public TypeFunctionDeclarationStatementSyntax WithExportKeyword ( SyntaxToken exportKeyword ) => Update ( exportKeyword , this . TypeKeyword , this . FunctionKeyword , this . Name , this . Parameters , this . TypeBinding , this . Body , this . EndKeyword , this . SemicolonToken ) ;
3765+ public TypeFunctionDeclarationStatementSyntax WithTypeKeyword ( SyntaxToken typeKeyword ) => Update ( this . ExportKeyword , typeKeyword , this . FunctionKeyword , this . Name , this . Parameters , this . TypeBinding , this . Body , this . EndKeyword , this . SemicolonToken ) ;
3766+ public TypeFunctionDeclarationStatementSyntax WithFunctionKeyword ( SyntaxToken functionKeyword ) => Update ( this . ExportKeyword , this . TypeKeyword , functionKeyword , this . Name , this . Parameters , this . TypeBinding , this . Body , this . EndKeyword , this . SemicolonToken ) ;
3767+ public TypeFunctionDeclarationStatementSyntax WithName ( SyntaxToken name ) => Update ( this . ExportKeyword , this . TypeKeyword , this . FunctionKeyword , name , this . Parameters , this . TypeBinding , this . Body , this . EndKeyword , this . SemicolonToken ) ;
3768+ public TypeFunctionDeclarationStatementSyntax WithParameters ( ParameterListSyntax parameters ) => Update ( this . ExportKeyword , this . TypeKeyword , this . FunctionKeyword , this . Name , parameters , this . TypeBinding , this . Body , this . EndKeyword , this . SemicolonToken ) ;
3769+ public TypeFunctionDeclarationStatementSyntax WithTypeBinding ( TypeBindingSyntax ? typeBinding ) => Update ( this . ExportKeyword , this . TypeKeyword , this . FunctionKeyword , this . Name , this . Parameters , typeBinding , this . Body , this . EndKeyword , this . SemicolonToken ) ;
3770+ public TypeFunctionDeclarationStatementSyntax WithBody ( StatementListSyntax body ) => Update ( this . ExportKeyword , this . TypeKeyword , this . FunctionKeyword , this . Name , this . Parameters , this . TypeBinding , body , this . EndKeyword , this . SemicolonToken ) ;
3771+ public TypeFunctionDeclarationStatementSyntax WithEndKeyword ( SyntaxToken endKeyword ) => Update ( this . ExportKeyword , this . TypeKeyword , this . FunctionKeyword , this . Name , this . Parameters , this . TypeBinding , this . Body , endKeyword , this . SemicolonToken ) ;
3772+ internal override StatementSyntax WithSemicolonTokenCore ( SyntaxToken semicolonToken ) => WithSemicolonToken ( semicolonToken ) ;
3773+ public new TypeFunctionDeclarationStatementSyntax WithSemicolonToken ( SyntaxToken semicolonToken ) => Update ( this . ExportKeyword , this . TypeKeyword , this . FunctionKeyword , this . Name , this . Parameters , this . TypeBinding , this . Body , this . EndKeyword , semicolonToken ) ;
3774+
3775+ public TypeFunctionDeclarationStatementSyntax AddParametersParameters ( params ParameterSyntax [ ] items ) => WithParameters ( this . Parameters . WithParameters ( this . Parameters . Parameters . AddRange ( items ) ) ) ;
3776+ public TypeFunctionDeclarationStatementSyntax AddBodyStatements ( params StatementSyntax [ ] items ) => WithBody ( this . Body . WithStatements ( this . Body . Statements . AddRange ( items ) ) ) ;
3777+ }
3778+
36723779 /// <summary>The base node for type annotations</summary>
36733780 public abstract partial class TypeSyntax : LuaSyntaxNode
36743781 {
0 commit comments