188 lines
8.0 KiB
C#
188 lines
8.0 KiB
C#
using System.Collections.Generic;
|
|||
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
||
|
|
|
||
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
||
|
|
|
||
|
|
public sealed class FieldDeclarationSyntax : BaseFieldDeclarationSyntax
|
||
|
|
{
|
||
|
|
private SyntaxNode? attributeLists;
|
||
|
|
|
||
|
|
private VariableDeclarationSyntax? declaration;
|
||
|
|
|
||
|
|
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 override VariableDeclarationSyntax Declaration => ((SyntaxNode)this).GetRed<VariableDeclarationSyntax>(ref declaration, 2);
|
||
|
|
|
||
|
|
public override SyntaxToken SemicolonToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.FieldDeclarationSyntax)(object)((SyntaxNode)this).Green).semicolonToken, ((SyntaxNode)this).GetChildPosition(3), ((SyntaxNode)this).GetChildIndex(3));
|
||
|
|
|
||
|
|
internal FieldDeclarationSyntax(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<VariableDeclarationSyntax>(ref declaration, 2),
|
||
|
|
_ => null,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
||
|
|
{
|
||
|
|
return (SyntaxNode?)(index switch
|
||
|
|
{
|
||
|
|
0 => attributeLists,
|
||
|
|
2 => declaration,
|
||
|
|
_ => null,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
||
|
|
{
|
||
|
|
visitor.VisitFieldDeclaration(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
||
|
|
{
|
||
|
|
return visitor.VisitFieldDeclaration(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public FieldDeclarationSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxTokenList modifiers, VariableDeclarationSyntax declaration, 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_0034: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_0037: 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_0025: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
if (attributeLists != AttributeLists || modifiers != Modifiers || declaration != Declaration || semicolonToken != SemicolonToken)
|
||
|
|
{
|
||
|
|
FieldDeclarationSyntax fieldDeclarationSyntax = SyntaxFactory.FieldDeclaration(attributeLists, modifiers, declaration, semicolonToken);
|
||
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
||
|
|
if (annotations == null || annotations.Length == 0)
|
||
|
|
{
|
||
|
|
return fieldDeclarationSyntax;
|
||
|
|
}
|
||
|
|
return fieldDeclarationSyntax.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 FieldDeclarationSyntax 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_000f: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(attributeLists, Modifiers, Declaration, 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 FieldDeclarationSyntax 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_000f: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(AttributeLists, modifiers, Declaration, SemicolonToken);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override BaseFieldDeclarationSyntax WithDeclarationCore(VariableDeclarationSyntax declaration)
|
||
|
|
{
|
||
|
|
return WithDeclaration(declaration);
|
||
|
|
}
|
||
|
|
|
||
|
|
public new FieldDeclarationSyntax WithDeclaration(VariableDeclarationSyntax declaration)
|
||
|
|
{
|
||
|
|
//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_000f: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(AttributeLists, Modifiers, declaration, SemicolonToken);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override BaseFieldDeclarationSyntax WithSemicolonTokenCore(SyntaxToken semicolonToken)
|
||
|
|
{
|
||
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return WithSemicolonToken(semicolonToken);
|
||
|
|
}
|
||
|
|
|
||
|
|
public new FieldDeclarationSyntax 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_0013: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(AttributeLists, Modifiers, Declaration, semicolonToken);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override MemberDeclarationSyntax AddAttributeListsCore(params AttributeListSyntax[] items)
|
||
|
|
{
|
||
|
|
return AddAttributeLists(items);
|
||
|
|
}
|
||
|
|
|
||
|
|
public new FieldDeclarationSyntax 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 FieldDeclarationSyntax 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));
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override BaseFieldDeclarationSyntax AddDeclarationVariablesCore(params VariableDeclaratorSyntax[] items)
|
||
|
|
{
|
||
|
|
return AddDeclarationVariables(items);
|
||
|
|
}
|
||
|
|
|
||
|
|
public new FieldDeclarationSyntax AddDeclarationVariables(params VariableDeclaratorSyntax[] 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 WithDeclaration(Declaration.WithVariables(Declaration.Variables.AddRange((IEnumerable<VariableDeclaratorSyntax>)items)));
|
||
|
|
}
|
||
|
|
}
|