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

151 lines
7.4 KiB
C#

using System.Collections.Generic;
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
public sealed class SwitchExpressionSyntax : ExpressionSyntax
{
private ExpressionSyntax? governingExpression;
private SyntaxNode? arms;
public ExpressionSyntax GoverningExpression => ((SyntaxNode)this).GetRedAtZero<ExpressionSyntax>(ref governingExpression);
public SyntaxToken SwitchKeyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SwitchExpressionSyntax)(object)((SyntaxNode)this).Green).switchKeyword, ((SyntaxNode)this).GetChildPosition(1), ((SyntaxNode)this).GetChildIndex(1));
public SyntaxToken OpenBraceToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SwitchExpressionSyntax)(object)((SyntaxNode)this).Green).openBraceToken, ((SyntaxNode)this).GetChildPosition(2), ((SyntaxNode)this).GetChildIndex(2));
public SeparatedSyntaxList<SwitchExpressionArmSyntax> Arms
{
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 arms, 3);
if (red == null)
{
return default(SeparatedSyntaxList<SwitchExpressionArmSyntax>);
}
return new SeparatedSyntaxList<SwitchExpressionArmSyntax>(red, ((SyntaxNode)this).GetChildIndex(3));
}
}
public SyntaxToken CloseBraceToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SwitchExpressionSyntax)(object)((SyntaxNode)this).Green).closeBraceToken, ((SyntaxNode)this).GetChildPosition(4), ((SyntaxNode)this).GetChildIndex(4));
internal SwitchExpressionSyntax(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<ExpressionSyntax>(ref governingExpression),
3 => ((SyntaxNode)this).GetRed(ref arms, 3),
_ => null,
});
}
internal override SyntaxNode? GetCachedSlot(int index)
{
return (SyntaxNode?)(index switch
{
0 => governingExpression,
3 => arms,
_ => null,
});
}
public override void Accept(CSharpSyntaxVisitor visitor)
{
visitor.VisitSwitchExpression(this);
}
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
{
return visitor.VisitSwitchExpression(this);
}
public SwitchExpressionSyntax Update(ExpressionSyntax governingExpression, SyntaxToken switchKeyword, SyntaxToken openBraceToken, SeparatedSyntaxList<SwitchExpressionArmSyntax> arms, SyntaxToken closeBraceToken)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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)
//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)
//IL_0034: 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)
if (governingExpression != GoverningExpression || switchKeyword != SwitchKeyword || openBraceToken != OpenBraceToken || arms != Arms || closeBraceToken != CloseBraceToken)
{
SwitchExpressionSyntax switchExpressionSyntax = SyntaxFactory.SwitchExpression(governingExpression, switchKeyword, openBraceToken, arms, closeBraceToken);
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
if (annotations == null || annotations.Length == 0)
{
return switchExpressionSyntax;
}
return switchExpressionSyntax.WithAnnotations(annotations);
}
return this;
}
public SwitchExpressionSyntax WithGoverningExpression(ExpressionSyntax governingExpression)
{
//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)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
return Update(governingExpression, SwitchKeyword, OpenBraceToken, Arms, CloseBraceToken);
}
public SwitchExpressionSyntax WithSwitchKeyword(SyntaxToken switchKeyword)
{
//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)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
return Update(GoverningExpression, switchKeyword, OpenBraceToken, Arms, CloseBraceToken);
}
public SwitchExpressionSyntax WithOpenBraceToken(SyntaxToken openBraceToken)
{
//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)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
return Update(GoverningExpression, SwitchKeyword, openBraceToken, Arms, CloseBraceToken);
}
public SwitchExpressionSyntax WithArms(SeparatedSyntaxList<SwitchExpressionArmSyntax> arms)
{
//IL_0008: 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)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
return Update(GoverningExpression, SwitchKeyword, OpenBraceToken, arms, CloseBraceToken);
}
public SwitchExpressionSyntax WithCloseBraceToken(SyntaxToken closeBraceToken)
{
//IL_0008: 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_0014: 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)
return Update(GoverningExpression, SwitchKeyword, OpenBraceToken, Arms, closeBraceToken);
}
public SwitchExpressionSyntax AddArms(params SwitchExpressionArmSyntax[] 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 WithArms(Arms.AddRange((IEnumerable<SwitchExpressionArmSyntax>)items));
}
}