105 lines
4.5 KiB
C#
105 lines
4.5 KiB
C#
using System.Collections.Generic;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class AccessorListSyntax : CSharpSyntaxNode
|
|
{
|
|
private SyntaxNode? accessors;
|
|
|
|
public SyntaxToken OpenBraceToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.AccessorListSyntax)(object)((SyntaxNode)this).Green).openBraceToken, ((SyntaxNode)this).Position, 0);
|
|
|
|
public SyntaxList<AccessorDeclarationSyntax> Accessors => new SyntaxList<AccessorDeclarationSyntax>(((SyntaxNode)this).GetRed(ref accessors, 1));
|
|
|
|
public SyntaxToken CloseBraceToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.AccessorListSyntax)(object)((SyntaxNode)this).Green).closeBraceToken, ((SyntaxNode)this).GetChildPosition(2), ((SyntaxNode)this).GetChildIndex(2));
|
|
|
|
internal AccessorListSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
|
|
: base((GreenNode)(object)green, parent, position)
|
|
{
|
|
}
|
|
|
|
internal override SyntaxNode? GetNodeSlot(int index)
|
|
{
|
|
if (index != 1)
|
|
{
|
|
return null;
|
|
}
|
|
return ((SyntaxNode)this).GetRed(ref accessors, 1);
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
if (index != 1)
|
|
{
|
|
return null;
|
|
}
|
|
return accessors;
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitAccessorList(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitAccessorList(this);
|
|
}
|
|
|
|
public AccessorListSyntax Update(SyntaxToken openBraceToken, SyntaxList<AccessorDeclarationSyntax> accessors, SyntaxToken closeBraceToken)
|
|
{
|
|
//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_002a: 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_002c: 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_001c: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
|
|
if (openBraceToken != OpenBraceToken || accessors != Accessors || closeBraceToken != CloseBraceToken)
|
|
{
|
|
AccessorListSyntax accessorListSyntax = SyntaxFactory.AccessorList(openBraceToken, accessors, closeBraceToken);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return accessorListSyntax;
|
|
}
|
|
return accessorListSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public AccessorListSyntax WithOpenBraceToken(SyntaxToken openBraceToken)
|
|
{
|
|
//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_0009: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(openBraceToken, Accessors, CloseBraceToken);
|
|
}
|
|
|
|
public AccessorListSyntax WithAccessors(SyntaxList<AccessorDeclarationSyntax> accessors)
|
|
{
|
|
//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_0009: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(OpenBraceToken, accessors, CloseBraceToken);
|
|
}
|
|
|
|
public AccessorListSyntax WithCloseBraceToken(SyntaxToken closeBraceToken)
|
|
{
|
|
//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_000d: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(OpenBraceToken, Accessors, closeBraceToken);
|
|
}
|
|
|
|
public AccessorListSyntax AddAccessors(params AccessorDeclarationSyntax[] 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 WithAccessors(Accessors.AddRange((IEnumerable<AccessorDeclarationSyntax>)items));
|
|
}
|
|
}
|