133 lines
5.8 KiB
C#
133 lines
5.8 KiB
C#
using System.Collections.Generic;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class AttributeListSyntax : CSharpSyntaxNode
|
|
{
|
|
private AttributeTargetSpecifierSyntax? target;
|
|
|
|
private SyntaxNode? attributes;
|
|
|
|
public SyntaxToken OpenBracketToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.AttributeListSyntax)(object)((SyntaxNode)this).Green).openBracketToken, ((SyntaxNode)this).Position, 0);
|
|
|
|
public AttributeTargetSpecifierSyntax? Target => ((SyntaxNode)this).GetRed<AttributeTargetSpecifierSyntax>(ref target, 1);
|
|
|
|
public SeparatedSyntaxList<AttributeSyntax> Attributes
|
|
{
|
|
get
|
|
{
|
|
//IL_0023: 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)
|
|
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
|
|
SyntaxNode red = ((SyntaxNode)this).GetRed(ref attributes, 2);
|
|
if (red == null)
|
|
{
|
|
return default(SeparatedSyntaxList<AttributeSyntax>);
|
|
}
|
|
return new SeparatedSyntaxList<AttributeSyntax>(red, ((SyntaxNode)this).GetChildIndex(2));
|
|
}
|
|
}
|
|
|
|
public SyntaxToken CloseBracketToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.AttributeListSyntax)(object)((SyntaxNode)this).Green).closeBracketToken, ((SyntaxNode)this).GetChildPosition(3), ((SyntaxNode)this).GetChildIndex(3));
|
|
|
|
internal AttributeListSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
|
|
: base((GreenNode)(object)green, parent, position)
|
|
{
|
|
}
|
|
|
|
internal override SyntaxNode? GetNodeSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
1 => ((SyntaxNode)this).GetRed<AttributeTargetSpecifierSyntax>(ref target, 1),
|
|
2 => ((SyntaxNode)this).GetRed(ref attributes, 2),
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
1 => target,
|
|
2 => attributes,
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitAttributeList(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitAttributeList(this);
|
|
}
|
|
|
|
public AttributeListSyntax Update(SyntaxToken openBracketToken, AttributeTargetSpecifierSyntax? target, SeparatedSyntaxList<AttributeSyntax> attributes, SyntaxToken closeBracketToken)
|
|
{
|
|
//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_0036: 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_0017: 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_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 (openBracketToken != OpenBracketToken || target != Target || attributes != Attributes || closeBracketToken != CloseBracketToken)
|
|
{
|
|
AttributeListSyntax attributeListSyntax = SyntaxFactory.AttributeList(openBracketToken, target, attributes, closeBracketToken);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return attributeListSyntax;
|
|
}
|
|
return attributeListSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public AttributeListSyntax WithOpenBracketToken(SyntaxToken openBracketToken)
|
|
{
|
|
//IL_0001: 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)
|
|
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(openBracketToken, Target, Attributes, CloseBracketToken);
|
|
}
|
|
|
|
public AttributeListSyntax WithTarget(AttributeTargetSpecifierSyntax? target)
|
|
{
|
|
//IL_0002: 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)
|
|
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(OpenBracketToken, target, Attributes, CloseBracketToken);
|
|
}
|
|
|
|
public AttributeListSyntax WithAttributes(SeparatedSyntaxList<AttributeSyntax> attributes)
|
|
{
|
|
//IL_0002: 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)
|
|
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(OpenBracketToken, Target, attributes, CloseBracketToken);
|
|
}
|
|
|
|
public AttributeListSyntax WithCloseBracketToken(SyntaxToken closeBracketToken)
|
|
{
|
|
//IL_0002: 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_0013: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(OpenBracketToken, Target, Attributes, closeBracketToken);
|
|
}
|
|
|
|
public AttributeListSyntax AddAttributes(params AttributeSyntax[] 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 WithAttributes(Attributes.AddRange((IEnumerable<AttributeSyntax>)items));
|
|
}
|
|
}
|