113 lines
3.8 KiB
C#
113 lines
3.8 KiB
C#
using System.ComponentModel;
|
|||
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
||
|
|
|
||
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
||
|
|
|
||
|
|
public sealed class ArgumentSyntax : CSharpSyntaxNode
|
||
|
|
{
|
||
|
|
private NameColonSyntax? nameColon;
|
||
|
|
|
||
|
|
private ExpressionSyntax? expression;
|
||
|
|
|
||
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||
|
|
public SyntaxToken RefOrOutKeyword => RefKindKeyword;
|
||
|
|
|
||
|
|
public NameColonSyntax? NameColon => ((SyntaxNode)this).GetRedAtZero<NameColonSyntax>(ref nameColon);
|
||
|
|
|
||
|
|
public SyntaxToken RefKindKeyword
|
||
|
|
{
|
||
|
|
get
|
||
|
|
{
|
||
|
|
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_0016: 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)
|
||
|
|
SyntaxToken refKindKeyword = ((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.ArgumentSyntax)(object)((SyntaxNode)this).Green).refKindKeyword;
|
||
|
|
if (refKindKeyword == null)
|
||
|
|
{
|
||
|
|
return default(SyntaxToken);
|
||
|
|
}
|
||
|
|
return new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)refKindKeyword, ((SyntaxNode)this).GetChildPosition(1), ((SyntaxNode)this).GetChildIndex(1));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public ExpressionSyntax Expression => ((SyntaxNode)this).GetRed<ExpressionSyntax>(ref expression, 2);
|
||
|
|
|
||
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
||
|
|
public ArgumentSyntax WithRefOrOutKeyword(SyntaxToken refOrOutKeyword)
|
||
|
|
{
|
||
|
|
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(NameColon, refOrOutKeyword, Expression);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal ArgumentSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
|
||
|
|
: base((GreenNode)(object)green, parent, position)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override SyntaxNode? GetNodeSlot(int index)
|
||
|
|
{
|
||
|
|
return (SyntaxNode?)(index switch
|
||
|
|
{
|
||
|
|
0 => ((SyntaxNode)this).GetRedAtZero<NameColonSyntax>(ref nameColon),
|
||
|
|
2 => ((SyntaxNode)this).GetRed<ExpressionSyntax>(ref expression, 2),
|
||
|
|
_ => null,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
||
|
|
{
|
||
|
|
return (SyntaxNode?)(index switch
|
||
|
|
{
|
||
|
|
0 => nameColon,
|
||
|
|
2 => expression,
|
||
|
|
_ => null,
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
||
|
|
{
|
||
|
|
visitor.VisitArgument(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
||
|
|
{
|
||
|
|
return visitor.VisitArgument(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public ArgumentSyntax Update(NameColonSyntax? nameColon, SyntaxToken refKindKeyword, ExpressionSyntax expression)
|
||
|
|
{
|
||
|
|
//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 (nameColon != NameColon || refKindKeyword != RefKindKeyword || expression != Expression)
|
||
|
|
{
|
||
|
|
ArgumentSyntax argumentSyntax = SyntaxFactory.Argument(nameColon, refKindKeyword, expression);
|
||
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
||
|
|
if (annotations == null || annotations.Length == 0)
|
||
|
|
{
|
||
|
|
return argumentSyntax;
|
||
|
|
}
|
||
|
|
return argumentSyntax.WithAnnotations(annotations);
|
||
|
|
}
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
public ArgumentSyntax WithNameColon(NameColonSyntax? nameColon)
|
||
|
|
{
|
||
|
|
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(nameColon, RefKindKeyword, Expression);
|
||
|
|
}
|
||
|
|
|
||
|
|
public ArgumentSyntax WithRefKindKeyword(SyntaxToken refKindKeyword)
|
||
|
|
{
|
||
|
|
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(NameColon, refKindKeyword, Expression);
|
||
|
|
}
|
||
|
|
|
||
|
|
public ArgumentSyntax WithExpression(ExpressionSyntax expression)
|
||
|
|
{
|
||
|
|
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(NameColon, RefKindKeyword, expression);
|
||
|
|
}
|
||
|
|
}
|