119 lines
5.2 KiB
C#
119 lines
5.2 KiB
C#
using System.Collections.Generic;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class PositionalPatternClauseSyntax : CSharpSyntaxNode
|
|
{
|
|
private SyntaxNode? subpatterns;
|
|
|
|
public SyntaxToken OpenParenToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.PositionalPatternClauseSyntax)(object)((SyntaxNode)this).Green).openParenToken, ((SyntaxNode)this).Position, 0);
|
|
|
|
public SeparatedSyntaxList<SubpatternSyntax> Subpatterns
|
|
{
|
|
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 subpatterns, 1);
|
|
if (red == null)
|
|
{
|
|
return default(SeparatedSyntaxList<SubpatternSyntax>);
|
|
}
|
|
return new SeparatedSyntaxList<SubpatternSyntax>(red, ((SyntaxNode)this).GetChildIndex(1));
|
|
}
|
|
}
|
|
|
|
public SyntaxToken CloseParenToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.PositionalPatternClauseSyntax)(object)((SyntaxNode)this).Green).closeParenToken, ((SyntaxNode)this).GetChildPosition(2), ((SyntaxNode)this).GetChildIndex(2));
|
|
|
|
internal PositionalPatternClauseSyntax(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 != 1)
|
|
{
|
|
return null;
|
|
}
|
|
return ((SyntaxNode)this).GetRed(ref subpatterns, 1);
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
if (index != 1)
|
|
{
|
|
return null;
|
|
}
|
|
return subpatterns;
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitPositionalPatternClause(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitPositionalPatternClause(this);
|
|
}
|
|
|
|
public PositionalPatternClauseSyntax Update(SyntaxToken openParenToken, SeparatedSyntaxList<SubpatternSyntax> subpatterns, SyntaxToken closeParenToken)
|
|
{
|
|
//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 (openParenToken != OpenParenToken || subpatterns != Subpatterns || closeParenToken != CloseParenToken)
|
|
{
|
|
PositionalPatternClauseSyntax positionalPatternClauseSyntax = SyntaxFactory.PositionalPatternClause(openParenToken, subpatterns, closeParenToken);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return positionalPatternClauseSyntax;
|
|
}
|
|
return positionalPatternClauseSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public PositionalPatternClauseSyntax WithOpenParenToken(SyntaxToken openParenToken)
|
|
{
|
|
//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(openParenToken, Subpatterns, CloseParenToken);
|
|
}
|
|
|
|
public PositionalPatternClauseSyntax WithSubpatterns(SeparatedSyntaxList<SubpatternSyntax> subpatterns)
|
|
{
|
|
//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(OpenParenToken, subpatterns, CloseParenToken);
|
|
}
|
|
|
|
public PositionalPatternClauseSyntax WithCloseParenToken(SyntaxToken closeParenToken)
|
|
{
|
|
//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(OpenParenToken, Subpatterns, closeParenToken);
|
|
}
|
|
|
|
public PositionalPatternClauseSyntax AddSubpatterns(params SubpatternSyntax[] 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 WithSubpatterns(Subpatterns.AddRange((IEnumerable<SubpatternSyntax>)items));
|
|
}
|
|
}
|