Files
2026-08-27 10:56:38 -06:00

90 lines
2.8 KiB
C#

using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
public sealed class TupleElementSyntax : CSharpSyntaxNode
{
private TypeSyntax? type;
public TypeSyntax Type => ((SyntaxNode)this).GetRedAtZero<TypeSyntax>(ref type);
public SyntaxToken Identifier
{
get
{
//IL_002e: 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 identifier = ((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.TupleElementSyntax)(object)((SyntaxNode)this).Green).identifier;
if (identifier == null)
{
return default(SyntaxToken);
}
return new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)identifier, ((SyntaxNode)this).GetChildPosition(1), ((SyntaxNode)this).GetChildIndex(1));
}
}
internal TupleElementSyntax(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 != 0)
{
return null;
}
return (SyntaxNode?)(object)((SyntaxNode)this).GetRedAtZero<TypeSyntax>(ref type);
}
internal override SyntaxNode? GetCachedSlot(int index)
{
if (index != 0)
{
return null;
}
return (SyntaxNode?)(object)type;
}
public override void Accept(CSharpSyntaxVisitor visitor)
{
visitor.VisitTupleElement(this);
}
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
{
return visitor.VisitTupleElement(this);
}
public TupleElementSyntax Update(TypeSyntax type, SyntaxToken identifier)
{
//IL_0018: 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_000b: Unknown result type (might be due to invalid IL or missing references)
if (type != Type || identifier != Identifier)
{
TupleElementSyntax tupleElementSyntax = SyntaxFactory.TupleElement(type, identifier);
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
if (annotations == null || annotations.Length == 0)
{
return tupleElementSyntax;
}
return tupleElementSyntax.WithAnnotations(annotations);
}
return this;
}
public TupleElementSyntax WithType(TypeSyntax type)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
return Update(type, Identifier);
}
public TupleElementSyntax WithIdentifier(SyntaxToken identifier)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return Update(Type, identifier);
}
}