103 lines
4.2 KiB
C#
103 lines
4.2 KiB
C#
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class GroupClauseSyntax : SelectOrGroupClauseSyntax
|
|
{
|
|
private ExpressionSyntax? groupExpression;
|
|
|
|
private ExpressionSyntax? byExpression;
|
|
|
|
public SyntaxToken GroupKeyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.GroupClauseSyntax)(object)((SyntaxNode)this).Green).groupKeyword, ((SyntaxNode)this).Position, 0);
|
|
|
|
public ExpressionSyntax GroupExpression => ((SyntaxNode)this).GetRed<ExpressionSyntax>(ref groupExpression, 1);
|
|
|
|
public SyntaxToken ByKeyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.GroupClauseSyntax)(object)((SyntaxNode)this).Green).byKeyword, ((SyntaxNode)this).GetChildPosition(2), ((SyntaxNode)this).GetChildIndex(2));
|
|
|
|
public ExpressionSyntax ByExpression => ((SyntaxNode)this).GetRed<ExpressionSyntax>(ref byExpression, 3);
|
|
|
|
internal GroupClauseSyntax(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
|
|
{
|
|
1 => ((SyntaxNode)this).GetRed<ExpressionSyntax>(ref groupExpression, 1),
|
|
3 => ((SyntaxNode)this).GetRed<ExpressionSyntax>(ref byExpression, 3),
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
1 => groupExpression,
|
|
3 => byExpression,
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitGroupClause(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitGroupClause(this);
|
|
}
|
|
|
|
public GroupClauseSyntax Update(SyntaxToken groupKeyword, ExpressionSyntax groupExpression, SyntaxToken byKeyword, ExpressionSyntax byExpression)
|
|
{
|
|
//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_002f: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0031: 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 (groupKeyword != GroupKeyword || groupExpression != GroupExpression || byKeyword != ByKeyword || byExpression != ByExpression)
|
|
{
|
|
GroupClauseSyntax groupClauseSyntax = SyntaxFactory.GroupClause(groupKeyword, groupExpression, byKeyword, byExpression);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return groupClauseSyntax;
|
|
}
|
|
return groupClauseSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public GroupClauseSyntax WithGroupKeyword(SyntaxToken groupKeyword)
|
|
{
|
|
//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(groupKeyword, GroupExpression, ByKeyword, ByExpression);
|
|
}
|
|
|
|
public GroupClauseSyntax WithGroupExpression(ExpressionSyntax groupExpression)
|
|
{
|
|
//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(GroupKeyword, groupExpression, ByKeyword, ByExpression);
|
|
}
|
|
|
|
public GroupClauseSyntax WithByKeyword(SyntaxToken byKeyword)
|
|
{
|
|
//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(GroupKeyword, GroupExpression, byKeyword, ByExpression);
|
|
}
|
|
|
|
public GroupClauseSyntax WithByExpression(ExpressionSyntax byExpression)
|
|
{
|
|
//IL_0002: 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)
|
|
return Update(GroupKeyword, GroupExpression, ByKeyword, byExpression);
|
|
}
|
|
}
|