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 RefExpressionSyntax : ExpressionSyntax
|
|
{
|
|
private ExpressionSyntax? expression;
|
|
|
|
public SyntaxToken RefKeyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.RefExpressionSyntax)(object)((SyntaxNode)this).Green).refKeyword, ((SyntaxNode)this).Position, 0);
|
|
|
|
public ExpressionSyntax Expression => ((SyntaxNode)this).GetRed<ExpressionSyntax>(ref expression, 1);
|
|
|
|
internal RefExpressionSyntax(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 expression, 1);
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
if (index != 1)
|
|
{
|
|
return null;
|
|
}
|
|
return (SyntaxNode?)(object)expression;
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitRefExpression(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitRefExpression(this);
|
|
}
|
|
|
|
public RefExpressionSyntax Update(SyntaxToken refKeyword, 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_0017: Unknown result type (might be due to invalid IL or missing references)
|
|
if (refKeyword != RefKeyword || expression != Expression)
|
|
{
|
|
RefExpressionSyntax refExpressionSyntax = SyntaxFactory.RefExpression(refKeyword, expression);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return refExpressionSyntax;
|
|
}
|
|
return refExpressionSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public RefExpressionSyntax WithRefKeyword(SyntaxToken refKeyword)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(refKeyword, Expression);
|
|
}
|
|
|
|
public RefExpressionSyntax WithExpression(ExpressionSyntax expression)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(RefKeyword, expression);
|
|
}
|
|
}
|