88 lines
3.1 KiB
C#
88 lines
3.1 KiB
C#
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|||
|
|
|
||
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
||
|
|
|
||
|
|
public sealed class MemberAccessExpressionSyntax : ExpressionSyntax
|
||
|
|
{
|
||
|
|
private ExpressionSyntax? expression;
|
||
|
|
|
||
|
|
private SimpleNameSyntax? name;
|
||
|
|
|
||
|
|
public ExpressionSyntax Expression => ((SyntaxNode)this).GetRedAtZero<ExpressionSyntax>(ref expression);
|
||
|
|
|
||
|
|
public SyntaxToken OperatorToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.MemberAccessExpressionSyntax)(object)((SyntaxNode)this).Green).operatorToken, ((SyntaxNode)this).GetChildPosition(1), ((SyntaxNode)this).GetChildIndex(1));
|
||
|
|
|
||
|
|
public SimpleNameSyntax Name => ((SyntaxNode)this).GetRed<SimpleNameSyntax>(ref name, 2);
|
||
|
|
|
||
|
|
internal MemberAccessExpressionSyntax(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
|
||
|
|
{
|
||
|
|
0 => ((SyntaxNode)this).GetRedAtZero<ExpressionSyntax>(ref expression),
|
||
|
|
2 => ((SyntaxNode)this).GetRed<SimpleNameSyntax>(ref name, 2),
|
||
|
|
_ => null,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
||
|
|
{
|
||
|
|
return (SyntaxNode?)(index switch
|
||
|
|
{
|
||
|
|
0 => expression,
|
||
|
|
2 => name,
|
||
|
|
_ => null,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
||
|
|
{
|
||
|
|
visitor.VisitMemberAccessExpression(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
||
|
|
{
|
||
|
|
return visitor.VisitMemberAccessExpression(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public MemberAccessExpressionSyntax Update(ExpressionSyntax expression, SyntaxToken operatorToken, SimpleNameSyntax name)
|
||
|
|
{
|
||
|
|
//IL_0027: 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)
|
||
|
|
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
if (expression != Expression || operatorToken != OperatorToken || name != Name)
|
||
|
|
{
|
||
|
|
MemberAccessExpressionSyntax memberAccessExpressionSyntax = SyntaxFactory.MemberAccessExpression(Kind(), expression, operatorToken, name);
|
||
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
||
|
|
if (annotations == null || annotations.Length == 0)
|
||
|
|
{
|
||
|
|
return memberAccessExpressionSyntax;
|
||
|
|
}
|
||
|
|
return memberAccessExpressionSyntax.WithAnnotations(annotations);
|
||
|
|
}
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
public MemberAccessExpressionSyntax WithExpression(ExpressionSyntax expression)
|
||
|
|
{
|
||
|
|
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(expression, OperatorToken, Name);
|
||
|
|
}
|
||
|
|
|
||
|
|
public MemberAccessExpressionSyntax WithOperatorToken(SyntaxToken operatorToken)
|
||
|
|
{
|
||
|
|
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(Expression, operatorToken, Name);
|
||
|
|
}
|
||
|
|
|
||
|
|
public MemberAccessExpressionSyntax WithName(SimpleNameSyntax name)
|
||
|
|
{
|
||
|
|
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(Expression, OperatorToken, name);
|
||
|
|
}
|
||
|
|
}
|