101 lines
3.5 KiB
C#
101 lines
3.5 KiB
C#
using System.Collections.Generic;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class QueryBodySyntax : CSharpSyntaxNode
|
|
{
|
|
private SyntaxNode? clauses;
|
|
|
|
private SelectOrGroupClauseSyntax? selectOrGroup;
|
|
|
|
private QueryContinuationSyntax? continuation;
|
|
|
|
public SyntaxList<QueryClauseSyntax> Clauses => new SyntaxList<QueryClauseSyntax>(((SyntaxNode)this).GetRed(ref clauses, 0));
|
|
|
|
public SelectOrGroupClauseSyntax SelectOrGroup => ((SyntaxNode)this).GetRed<SelectOrGroupClauseSyntax>(ref selectOrGroup, 1);
|
|
|
|
public QueryContinuationSyntax? Continuation => ((SyntaxNode)this).GetRed<QueryContinuationSyntax>(ref continuation, 2);
|
|
|
|
internal QueryBodySyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
|
|
: base((GreenNode)(object)green, parent, position)
|
|
{
|
|
}
|
|
|
|
internal override SyntaxNode? GetNodeSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
0 => ((SyntaxNode)this).GetRedAtZero(ref clauses),
|
|
1 => ((SyntaxNode)this).GetRed<SelectOrGroupClauseSyntax>(ref selectOrGroup, 1),
|
|
2 => ((SyntaxNode)this).GetRed<QueryContinuationSyntax>(ref continuation, 2),
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
0 => clauses,
|
|
1 => selectOrGroup,
|
|
2 => continuation,
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitQueryBody(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitQueryBody(this);
|
|
}
|
|
|
|
public QueryBodySyntax Update(SyntaxList<QueryClauseSyntax> clauses, SelectOrGroupClauseSyntax selectOrGroup, QueryContinuationSyntax? continuation)
|
|
{
|
|
//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_0020: Unknown result type (might be due to invalid IL or missing references)
|
|
if (clauses != Clauses || selectOrGroup != SelectOrGroup || continuation != Continuation)
|
|
{
|
|
QueryBodySyntax queryBodySyntax = SyntaxFactory.QueryBody(clauses, selectOrGroup, continuation);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return queryBodySyntax;
|
|
}
|
|
return queryBodySyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public QueryBodySyntax WithClauses(SyntaxList<QueryClauseSyntax> clauses)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(clauses, SelectOrGroup, Continuation);
|
|
}
|
|
|
|
public QueryBodySyntax WithSelectOrGroup(SelectOrGroupClauseSyntax selectOrGroup)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(Clauses, selectOrGroup, Continuation);
|
|
}
|
|
|
|
public QueryBodySyntax WithContinuation(QueryContinuationSyntax? continuation)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(Clauses, SelectOrGroup, continuation);
|
|
}
|
|
|
|
public QueryBodySyntax AddClauses(params QueryClauseSyntax[] 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 WithClauses(Clauses.AddRange((IEnumerable<QueryClauseSyntax>)items));
|
|
}
|
|
}
|