Files

399 lines
21 KiB
C#
Raw Permalink Normal View History

2026-08-27 10:56:38 -06:00
using System.Collections.Generic;
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
public sealed class MethodDeclarationSyntax : BaseMethodDeclarationSyntax
{
private SyntaxNode? attributeLists;
private TypeSyntax? returnType;
private ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier;
private TypeParameterListSyntax? typeParameterList;
private ParameterListSyntax? parameterList;
private SyntaxNode? constraintClauses;
private BlockSyntax? body;
private ArrowExpressionClauseSyntax? expressionBody;
public int Arity
{
get
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
if (TypeParameterList != null)
{
return TypeParameterList.Parameters.Count;
}
return 0;
}
}
public override SyntaxList<AttributeListSyntax> AttributeLists => new SyntaxList<AttributeListSyntax>(((SyntaxNode)this).GetRed(ref attributeLists, 0));
public override SyntaxTokenList Modifiers
{
get
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
GreenNode slot = ((SyntaxNode)this).Green.GetSlot(1);
if (slot == null)
{
return default(SyntaxTokenList);
}
return new SyntaxTokenList((SyntaxNode)(object)this, slot, ((SyntaxNode)this).GetChildPosition(1), ((SyntaxNode)this).GetChildIndex(1));
}
}
public TypeSyntax ReturnType => ((SyntaxNode)this).GetRed<TypeSyntax>(ref returnType, 2);
public ExplicitInterfaceSpecifierSyntax? ExplicitInterfaceSpecifier => ((SyntaxNode)this).GetRed<ExplicitInterfaceSpecifierSyntax>(ref explicitInterfaceSpecifier, 3);
public SyntaxToken Identifier => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.MethodDeclarationSyntax)(object)((SyntaxNode)this).Green).identifier, ((SyntaxNode)this).GetChildPosition(4), ((SyntaxNode)this).GetChildIndex(4));
public TypeParameterListSyntax? TypeParameterList => ((SyntaxNode)this).GetRed<TypeParameterListSyntax>(ref typeParameterList, 5);
public override ParameterListSyntax ParameterList => ((SyntaxNode)this).GetRed<ParameterListSyntax>(ref parameterList, 6);
public SyntaxList<TypeParameterConstraintClauseSyntax> ConstraintClauses => new SyntaxList<TypeParameterConstraintClauseSyntax>(((SyntaxNode)this).GetRed(ref constraintClauses, 7));
public override BlockSyntax? Body => ((SyntaxNode)this).GetRed<BlockSyntax>(ref body, 8);
public override ArrowExpressionClauseSyntax? ExpressionBody => ((SyntaxNode)this).GetRed<ArrowExpressionClauseSyntax>(ref expressionBody, 9);
public override SyntaxToken SemicolonToken
{
get
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
SyntaxToken semicolonToken = ((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.MethodDeclarationSyntax)(object)((SyntaxNode)this).Green).semicolonToken;
if (semicolonToken == null)
{
return default(SyntaxToken);
}
return new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)semicolonToken, ((SyntaxNode)this).GetChildPosition(10), ((SyntaxNode)this).GetChildIndex(10));
}
}
internal MethodDeclarationSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
: base(green, parent, position)
{
}
internal override SyntaxNode? GetNodeSlot(int index)
{
return (SyntaxNode?)(index switch
{
0 => ((SyntaxNode)this).GetRedAtZero(ref attributeLists),
2 => ((SyntaxNode)this).GetRed<TypeSyntax>(ref returnType, 2),
3 => ((SyntaxNode)this).GetRed<ExplicitInterfaceSpecifierSyntax>(ref explicitInterfaceSpecifier, 3),
5 => ((SyntaxNode)this).GetRed<TypeParameterListSyntax>(ref typeParameterList, 5),
6 => ((SyntaxNode)this).GetRed<ParameterListSyntax>(ref parameterList, 6),
7 => ((SyntaxNode)this).GetRed(ref constraintClauses, 7),
8 => ((SyntaxNode)this).GetRed<BlockSyntax>(ref body, 8),
9 => ((SyntaxNode)this).GetRed<ArrowExpressionClauseSyntax>(ref expressionBody, 9),
_ => null,
});
}
internal override SyntaxNode? GetCachedSlot(int index)
{
return (SyntaxNode?)(index switch
{
0 => attributeLists,
2 => returnType,
3 => explicitInterfaceSpecifier,
5 => typeParameterList,
6 => parameterList,
7 => constraintClauses,
8 => body,
9 => expressionBody,
_ => null,
});
}
public override void Accept(CSharpSyntaxVisitor visitor)
{
visitor.VisitMethodDeclaration(this);
}
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
{
return visitor.VisitMethodDeclaration(this);
}
public MethodDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, TypeSyntax returnType, ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier, SyntaxToken identifier, TypeParameterListSyntax? typeParameterList, ParameterListSyntax parameterList, SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses, BlockSyntax? body, ArrowExpressionClauseSyntax? expressionBody, SyntaxToken semicolonToken)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if (attributeLists != AttributeLists || modifiers != Modifiers || returnType != ReturnType || explicitInterfaceSpecifier != ExplicitInterfaceSpecifier || identifier != Identifier || typeParameterList != TypeParameterList || parameterList != ParameterList || constraintClauses != ConstraintClauses || body != Body || expressionBody != ExpressionBody || semicolonToken != SemicolonToken)
{
MethodDeclarationSyntax methodDeclarationSyntax = SyntaxFactory.MethodDeclaration(attributeLists, modifiers, returnType, explicitInterfaceSpecifier, identifier, typeParameterList, parameterList, constraintClauses, body, expressionBody, semicolonToken);
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
if (annotations == null || annotations.Length == 0)
{
return methodDeclarationSyntax;
}
return methodDeclarationSyntax.WithAnnotations(annotations);
}
return this;
}
internal override MemberDeclarationSyntax WithAttributeListsCore(SyntaxList<AttributeListSyntax> attributeLists)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return WithAttributeLists(attributeLists);
}
public new MethodDeclarationSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
return Update(attributeLists, Modifiers, ReturnType, ExplicitInterfaceSpecifier, Identifier, TypeParameterList, ParameterList, ConstraintClauses, Body, ExpressionBody, SemicolonToken);
}
internal override MemberDeclarationSyntax WithModifiersCore(SyntaxTokenList modifiers)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return WithModifiers(modifiers);
}
public new MethodDeclarationSyntax WithModifiers(SyntaxTokenList modifiers)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
return Update(AttributeLists, modifiers, ReturnType, ExplicitInterfaceSpecifier, Identifier, TypeParameterList, ParameterList, ConstraintClauses, Body, ExpressionBody, SemicolonToken);
}
public MethodDeclarationSyntax WithReturnType(TypeSyntax returnType)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
return Update(AttributeLists, Modifiers, returnType, ExplicitInterfaceSpecifier, Identifier, TypeParameterList, ParameterList, ConstraintClauses, Body, ExpressionBody, SemicolonToken);
}
public MethodDeclarationSyntax WithExplicitInterfaceSpecifier(ExplicitInterfaceSpecifierSyntax? explicitInterfaceSpecifier)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
return Update(AttributeLists, Modifiers, ReturnType, explicitInterfaceSpecifier, Identifier, TypeParameterList, ParameterList, ConstraintClauses, Body, ExpressionBody, SemicolonToken);
}
public MethodDeclarationSyntax WithIdentifier(SyntaxToken identifier)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
return Update(AttributeLists, Modifiers, ReturnType, ExplicitInterfaceSpecifier, identifier, TypeParameterList, ParameterList, ConstraintClauses, Body, ExpressionBody, SemicolonToken);
}
public MethodDeclarationSyntax WithTypeParameterList(TypeParameterListSyntax? typeParameterList)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
return Update(AttributeLists, Modifiers, ReturnType, ExplicitInterfaceSpecifier, Identifier, typeParameterList, ParameterList, ConstraintClauses, Body, ExpressionBody, SemicolonToken);
}
internal override BaseMethodDeclarationSyntax WithParameterListCore(ParameterListSyntax parameterList)
{
return WithParameterList(parameterList);
}
public new MethodDeclarationSyntax WithParameterList(ParameterListSyntax parameterList)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
return Update(AttributeLists, Modifiers, ReturnType, ExplicitInterfaceSpecifier, Identifier, TypeParameterList, parameterList, ConstraintClauses, Body, ExpressionBody, SemicolonToken);
}
public MethodDeclarationSyntax WithConstraintClauses(SyntaxList<TypeParameterConstraintClauseSyntax> constraintClauses)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
return Update(AttributeLists, Modifiers, ReturnType, ExplicitInterfaceSpecifier, Identifier, TypeParameterList, ParameterList, constraintClauses, Body, ExpressionBody, SemicolonToken);
}
internal override BaseMethodDeclarationSyntax WithBodyCore(BlockSyntax? body)
{
return WithBody(body);
}
public new MethodDeclarationSyntax WithBody(BlockSyntax? body)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
return Update(AttributeLists, Modifiers, ReturnType, ExplicitInterfaceSpecifier, Identifier, TypeParameterList, ParameterList, ConstraintClauses, body, ExpressionBody, SemicolonToken);
}
internal override BaseMethodDeclarationSyntax WithExpressionBodyCore(ArrowExpressionClauseSyntax? expressionBody)
{
return WithExpressionBody(expressionBody);
}
public new MethodDeclarationSyntax WithExpressionBody(ArrowExpressionClauseSyntax? expressionBody)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
return Update(AttributeLists, Modifiers, ReturnType, ExplicitInterfaceSpecifier, Identifier, TypeParameterList, ParameterList, ConstraintClauses, Body, expressionBody, SemicolonToken);
}
internal override BaseMethodDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return WithSemicolonToken(semicolonToken);
}
public new MethodDeclarationSyntax WithSemicolonToken(SyntaxToken semicolonToken)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
return Update(AttributeLists, Modifiers, ReturnType, ExplicitInterfaceSpecifier, Identifier, TypeParameterList, ParameterList, ConstraintClauses, Body, ExpressionBody, semicolonToken);
}
internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items)
{
return AddAttributeLists(items);
}
public new MethodDeclarationSyntax AddAttributeLists(params AttributeListSyntax[] items)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
return WithAttributeLists(AttributeLists.AddRange((IEnumerable<AttributeListSyntax>)items));
}
internal override MemberDeclarationSyntax AddModifiersCore(params SyntaxToken[] items)
{
return AddModifiers(items);
}
public new MethodDeclarationSyntax AddModifiers(params SyntaxToken[] items)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
SyntaxTokenList modifiers = Modifiers;
return WithModifiers(((SyntaxTokenList)(ref modifiers)).AddRange((IEnumerable<SyntaxToken>)items));
}
public MethodDeclarationSyntax AddTypeParameterListParameters(params TypeParameterSyntax[] items)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
TypeParameterListSyntax typeParameterListSyntax = TypeParameterList ?? SyntaxFactory.TypeParameterList();
return WithTypeParameterList(typeParameterListSyntax.WithParameters(typeParameterListSyntax.Parameters.AddRange((IEnumerable<TypeParameterSyntax>)items)));
}
internal override BaseMethodDeclarationSyntax AddParameterListParametersCore(params ParameterSyntax[] items)
{
return AddParameterListParameters(items);
}
public new MethodDeclarationSyntax AddParameterListParameters(params ParameterSyntax[] items)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
return WithParameterList(ParameterList.WithParameters(ParameterList.Parameters.AddRange((IEnumerable<ParameterSyntax>)items)));
}
public MethodDeclarationSyntax AddConstraintClauses(params TypeParameterConstraintClauseSyntax[] items)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
return WithConstraintClauses(ConstraintClauses.AddRange((IEnumerable<TypeParameterConstraintClauseSyntax>)items));
}
internal override BaseMethodDeclarationSyntax AddBodyAttributeListsCore(params AttributeListSyntax[] items)
{
return AddBodyAttributeLists(items);
}
public new MethodDeclarationSyntax AddBodyAttributeLists(params AttributeListSyntax[] items)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
BlockSyntax blockSyntax = Body ?? SyntaxFactory.Block();
return WithBody(blockSyntax.WithAttributeLists(blockSyntax.AttributeLists.AddRange((IEnumerable<AttributeListSyntax>)items)));
}
internal override BaseMethodDeclarationSyntax AddBodyStatementsCore(params StatementSyntax[] items)
{
return AddBodyStatements(items);
}
public new MethodDeclarationSyntax AddBodyStatements(params StatementSyntax[] items)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
BlockSyntax blockSyntax = Body ?? SyntaxFactory.Block();
return WithBody(blockSyntax.WithStatements(blockSyntax.Statements.AddRange((IEnumerable<StatementSyntax>)items)));
}
}