76 lines
2.4 KiB
C#
76 lines
2.4 KiB
C#
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class SlicePatternSyntax : PatternSyntax
|
|
{
|
|
private PatternSyntax? pattern;
|
|
|
|
public SyntaxToken DotDotToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SlicePatternSyntax)(object)((SyntaxNode)this).Green).dotDotToken, ((SyntaxNode)this).Position, 0);
|
|
|
|
public PatternSyntax? Pattern => ((SyntaxNode)this).GetRed<PatternSyntax>(ref pattern, 1);
|
|
|
|
internal SlicePatternSyntax(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<PatternSyntax>(ref pattern, 1);
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
if (index != 1)
|
|
{
|
|
return null;
|
|
}
|
|
return (SyntaxNode?)(object)pattern;
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitSlicePattern(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitSlicePattern(this);
|
|
}
|
|
|
|
public SlicePatternSyntax Update(SyntaxToken dotDotToken, PatternSyntax? pattern)
|
|
{
|
|
//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_0017: Unknown result type (might be due to invalid IL or missing references)
|
|
if (dotDotToken != DotDotToken || pattern != Pattern)
|
|
{
|
|
SlicePatternSyntax slicePatternSyntax = SyntaxFactory.SlicePattern(dotDotToken, pattern);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return slicePatternSyntax;
|
|
}
|
|
return slicePatternSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public SlicePatternSyntax WithDotDotToken(SyntaxToken dotDotToken)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(dotDotToken, Pattern);
|
|
}
|
|
|
|
public SlicePatternSyntax WithPattern(PatternSyntax? pattern)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(DotDotToken, pattern);
|
|
}
|
|
}
|