106 lines
4.7 KiB
C#
106 lines
4.7 KiB
C#
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class LetClauseSyntax : QueryClauseSyntax
|
|
{
|
|
private ExpressionSyntax? expression;
|
|
|
|
public SyntaxToken LetKeyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LetClauseSyntax)(object)((SyntaxNode)this).Green).letKeyword, ((SyntaxNode)this).Position, 0);
|
|
|
|
public SyntaxToken Identifier => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LetClauseSyntax)(object)((SyntaxNode)this).Green).identifier, ((SyntaxNode)this).GetChildPosition(1), ((SyntaxNode)this).GetChildIndex(1));
|
|
|
|
public SyntaxToken EqualsToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.LetClauseSyntax)(object)((SyntaxNode)this).Green).equalsToken, ((SyntaxNode)this).GetChildPosition(2), ((SyntaxNode)this).GetChildIndex(2));
|
|
|
|
public ExpressionSyntax Expression => ((SyntaxNode)this).GetRed<ExpressionSyntax>(ref expression, 3);
|
|
|
|
internal LetClauseSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
|
|
: base(green, parent, position)
|
|
{
|
|
}
|
|
|
|
internal override SyntaxNode? GetNodeSlot(int index)
|
|
{
|
|
if (index != 3)
|
|
{
|
|
return null;
|
|
}
|
|
return (SyntaxNode?)(object)((SyntaxNode)this).GetRed<ExpressionSyntax>(ref expression, 3);
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
if (index != 3)
|
|
{
|
|
return null;
|
|
}
|
|
return (SyntaxNode?)(object)expression;
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitLetClause(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitLetClause(this);
|
|
}
|
|
|
|
public LetClauseSyntax Update(SyntaxToken letKeyword, SyntaxToken identifier, SyntaxToken equalsToken, ExpressionSyntax expression)
|
|
{
|
|
//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_0034: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0036: 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 (letKeyword != LetKeyword || identifier != Identifier || equalsToken != EqualsToken || expression != Expression)
|
|
{
|
|
LetClauseSyntax letClauseSyntax = SyntaxFactory.LetClause(letKeyword, identifier, equalsToken, expression);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return letClauseSyntax;
|
|
}
|
|
return letClauseSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public LetClauseSyntax WithLetKeyword(SyntaxToken letKeyword)
|
|
{
|
|
//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(letKeyword, Identifier, EqualsToken, Expression);
|
|
}
|
|
|
|
public LetClauseSyntax WithIdentifier(SyntaxToken identifier)
|
|
{
|
|
//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(LetKeyword, identifier, EqualsToken, Expression);
|
|
}
|
|
|
|
public LetClauseSyntax WithEqualsToken(SyntaxToken equalsToken)
|
|
{
|
|
//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(LetKeyword, Identifier, equalsToken, Expression);
|
|
}
|
|
|
|
public LetClauseSyntax WithExpression(ExpressionSyntax expression)
|
|
{
|
|
//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_000e: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(LetKeyword, Identifier, EqualsToken, expression);
|
|
}
|
|
}
|