98 lines
3.0 KiB
C#
98 lines
3.0 KiB
C#
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class QualifiedNameSyntax : NameSyntax
|
|
{
|
|
private NameSyntax? left;
|
|
|
|
private SimpleNameSyntax? right;
|
|
|
|
public NameSyntax Left => ((SyntaxNode)this).GetRedAtZero<NameSyntax>(ref left);
|
|
|
|
public SyntaxToken DotToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.QualifiedNameSyntax)(object)((SyntaxNode)this).Green).dotToken, ((SyntaxNode)this).GetChildPosition(1), ((SyntaxNode)this).GetChildIndex(1));
|
|
|
|
public SimpleNameSyntax Right => ((SyntaxNode)this).GetRed<SimpleNameSyntax>(ref right, 2);
|
|
|
|
internal override SimpleNameSyntax GetUnqualifiedName()
|
|
{
|
|
return Right;
|
|
}
|
|
|
|
internal override string ErrorDisplayName()
|
|
{
|
|
return Left.ErrorDisplayName() + "." + Right.ErrorDisplayName();
|
|
}
|
|
|
|
internal QualifiedNameSyntax(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<NameSyntax>(ref left),
|
|
2 => ((SyntaxNode)this).GetRed<SimpleNameSyntax>(ref right, 2),
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
0 => left,
|
|
2 => right,
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitQualifiedName(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitQualifiedName(this);
|
|
}
|
|
|
|
public QualifiedNameSyntax Update(NameSyntax left, SyntaxToken dotToken, SimpleNameSyntax right)
|
|
{
|
|
//IL_0021: 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 (left != Left || dotToken != DotToken || right != Right)
|
|
{
|
|
QualifiedNameSyntax qualifiedNameSyntax = SyntaxFactory.QualifiedName(left, dotToken, right);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return qualifiedNameSyntax;
|
|
}
|
|
return qualifiedNameSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public QualifiedNameSyntax WithLeft(NameSyntax left)
|
|
{
|
|
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(left, DotToken, Right);
|
|
}
|
|
|
|
public QualifiedNameSyntax WithDotToken(SyntaxToken dotToken)
|
|
{
|
|
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(Left, dotToken, Right);
|
|
}
|
|
|
|
public QualifiedNameSyntax WithRight(SimpleNameSyntax right)
|
|
{
|
|
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(Left, DotToken, right);
|
|
}
|
|
}
|