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 WhereClauseSyntax : QueryClauseSyntax
|
|
{
|
|
private ExpressionSyntax? condition;
|
|
|
|
public SyntaxToken WhereKeyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.WhereClauseSyntax)(object)((SyntaxNode)this).Green).whereKeyword, ((SyntaxNode)this).Position, 0);
|
|
|
|
public ExpressionSyntax Condition => ((SyntaxNode)this).GetRed<ExpressionSyntax>(ref condition, 1);
|
|
|
|
internal WhereClauseSyntax(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 condition, 1);
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
if (index != 1)
|
|
{
|
|
return null;
|
|
}
|
|
return (SyntaxNode?)(object)condition;
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitWhereClause(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitWhereClause(this);
|
|
}
|
|
|
|
public WhereClauseSyntax Update(SyntaxToken whereKeyword, ExpressionSyntax condition)
|
|
{
|
|
//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 (whereKeyword != WhereKeyword || condition != Condition)
|
|
{
|
|
WhereClauseSyntax whereClauseSyntax = SyntaxFactory.WhereClause(whereKeyword, condition);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return whereClauseSyntax;
|
|
}
|
|
return whereClauseSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public WhereClauseSyntax WithWhereKeyword(SyntaxToken whereKeyword)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(whereKeyword, Condition);
|
|
}
|
|
|
|
public WhereClauseSyntax WithCondition(ExpressionSyntax condition)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(WhereKeyword, condition);
|
|
}
|
|
}
|