Files

119 lines
5.1 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 CollectionExpressionSyntax : ExpressionSyntax
{
private SyntaxNode? elements;
public SyntaxToken OpenBracketToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CollectionExpressionSyntax)(object)((SyntaxNode)this).Green).openBracketToken, ((SyntaxNode)this).Position, 0);
public SeparatedSyntaxList<CollectionElementSyntax> Elements
{
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 elements, 1);
if (red == null)
{
return default(SeparatedSyntaxList<CollectionElementSyntax>);
}
return new SeparatedSyntaxList<CollectionElementSyntax>(red, ((SyntaxNode)this).GetChildIndex(1));
}
}
public SyntaxToken CloseBracketToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CollectionExpressionSyntax)(object)((SyntaxNode)this).Green).closeBracketToken, ((SyntaxNode)this).GetChildPosition(2), ((SyntaxNode)this).GetChildIndex(2));
internal CollectionExpressionSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
: base(green, parent, position)
{
}
internal override SyntaxNode? GetNodeSlot(int index)
{
if (index != 1)
{
return null;
}
return ((SyntaxNode)this).GetRed(ref elements, 1);
}
internal override SyntaxNode? GetCachedSlot(int index)
{
if (index != 1)
{
return null;
}
return elements;
}
public override void Accept(CSharpSyntaxVisitor visitor)
{
visitor.VisitCollectionExpression(this);
}
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
{
return visitor.VisitCollectionExpression(this);
}
public CollectionExpressionSyntax Update(SyntaxToken openBracketToken, SeparatedSyntaxList<CollectionElementSyntax> elements, 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_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 (openBracketToken != OpenBracketToken || elements != Elements || closeBracketToken != CloseBracketToken)
{
CollectionExpressionSyntax collectionExpressionSyntax = SyntaxFactory.CollectionExpression(openBracketToken, elements, closeBracketToken);
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
if (annotations == null || annotations.Length == 0)
{
return collectionExpressionSyntax;
}
return collectionExpressionSyntax.WithAnnotations(annotations);
}
return this;
}
public CollectionExpressionSyntax WithOpenBracketToken(SyntaxToken openBracketToken)
{
//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(openBracketToken, Elements, CloseBracketToken);
}
public CollectionExpressionSyntax WithElements(SeparatedSyntaxList<CollectionElementSyntax> elements)
{
//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(OpenBracketToken, elements, CloseBracketToken);
}
public CollectionExpressionSyntax WithCloseBracketToken(SyntaxToken closeBracketToken)
{
//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(OpenBracketToken, Elements, closeBracketToken);
}
public CollectionExpressionSyntax AddElements(params CollectionElementSyntax[] 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 WithElements(Elements.AddRange((IEnumerable<CollectionElementSyntax>)items));
}
}