102 lines
3.8 KiB
C#
102 lines
3.8 KiB
C#
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|||
|
|
|
||
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
||
|
|
|
||
|
|
public sealed class CaseSwitchLabelSyntax : SwitchLabelSyntax
|
||
|
|
{
|
||
|
|
private ExpressionSyntax? value;
|
||
|
|
|
||
|
|
public override SyntaxToken Keyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CaseSwitchLabelSyntax)(object)((SyntaxNode)this).Green).keyword, ((SyntaxNode)this).Position, 0);
|
||
|
|
|
||
|
|
public ExpressionSyntax Value => ((SyntaxNode)this).GetRed<ExpressionSyntax>(ref value, 1);
|
||
|
|
|
||
|
|
public override SyntaxToken ColonToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CaseSwitchLabelSyntax)(object)((SyntaxNode)this).Green).colonToken, ((SyntaxNode)this).GetChildPosition(2), ((SyntaxNode)this).GetChildIndex(2));
|
||
|
|
|
||
|
|
internal CaseSwitchLabelSyntax(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?)(object)((SyntaxNode)this).GetRed<ExpressionSyntax>(ref value, 1);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
||
|
|
{
|
||
|
|
if (index != 1)
|
||
|
|
{
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
return (SyntaxNode?)(object)value;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
||
|
|
{
|
||
|
|
visitor.VisitCaseSwitchLabel(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
||
|
|
{
|
||
|
|
return visitor.VisitCaseSwitchLabel(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public CaseSwitchLabelSyntax Update(SyntaxToken keyword, ExpressionSyntax value, SyntaxToken colonToken)
|
||
|
|
{
|
||
|
|
//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_0025: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_0027: 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)
|
||
|
|
if (keyword != Keyword || value != Value || colonToken != ColonToken)
|
||
|
|
{
|
||
|
|
CaseSwitchLabelSyntax caseSwitchLabelSyntax = SyntaxFactory.CaseSwitchLabel(keyword, value, colonToken);
|
||
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
||
|
|
if (annotations == null || annotations.Length == 0)
|
||
|
|
{
|
||
|
|
return caseSwitchLabelSyntax;
|
||
|
|
}
|
||
|
|
return caseSwitchLabelSyntax.WithAnnotations(annotations);
|
||
|
|
}
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override SwitchLabelSyntax WithKeywordCore(SyntaxToken keyword)
|
||
|
|
{
|
||
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return WithKeyword(keyword);
|
||
|
|
}
|
||
|
|
|
||
|
|
public new CaseSwitchLabelSyntax WithKeyword(SyntaxToken keyword)
|
||
|
|
{
|
||
|
|
//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)
|
||
|
|
return Update(keyword, Value, ColonToken);
|
||
|
|
}
|
||
|
|
|
||
|
|
public CaseSwitchLabelSyntax WithValue(ExpressionSyntax value)
|
||
|
|
{
|
||
|
|
//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)
|
||
|
|
return Update(Keyword, value, ColonToken);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override SwitchLabelSyntax WithColonTokenCore(SyntaxToken colonToken)
|
||
|
|
{
|
||
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return WithColonToken(colonToken);
|
||
|
|
}
|
||
|
|
|
||
|
|
public new CaseSwitchLabelSyntax WithColonToken(SyntaxToken colonToken)
|
||
|
|
{
|
||
|
|
//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)
|
||
|
|
return Update(Keyword, Value, colonToken);
|
||
|
|
}
|
||
|
|
}
|