106 lines
4.8 KiB
C#
106 lines
4.8 KiB
C#
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|||
|
|
|
||
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
||
|
|
|
||
|
|
public sealed class DefaultExpressionSyntax : ExpressionSyntax
|
||
|
|
{
|
||
|
|
private TypeSyntax? type;
|
||
|
|
|
||
|
|
public SyntaxToken Keyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.DefaultExpressionSyntax)(object)((SyntaxNode)this).Green).keyword, ((SyntaxNode)this).Position, 0);
|
||
|
|
|
||
|
|
public SyntaxToken OpenParenToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.DefaultExpressionSyntax)(object)((SyntaxNode)this).Green).openParenToken, ((SyntaxNode)this).GetChildPosition(1), ((SyntaxNode)this).GetChildIndex(1));
|
||
|
|
|
||
|
|
public TypeSyntax Type => ((SyntaxNode)this).GetRed<TypeSyntax>(ref type, 2);
|
||
|
|
|
||
|
|
public SyntaxToken CloseParenToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.DefaultExpressionSyntax)(object)((SyntaxNode)this).Green).closeParenToken, ((SyntaxNode)this).GetChildPosition(3), ((SyntaxNode)this).GetChildIndex(3));
|
||
|
|
|
||
|
|
internal DefaultExpressionSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
|
||
|
|
: base(green, parent, position)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override SyntaxNode? GetNodeSlot(int index)
|
||
|
|
{
|
||
|
|
if (index != 2)
|
||
|
|
{
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
return (SyntaxNode?)(object)((SyntaxNode)this).GetRed<TypeSyntax>(ref type, 2);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
||
|
|
{
|
||
|
|
if (index != 2)
|
||
|
|
{
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
return (SyntaxNode?)(object)type;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
||
|
|
{
|
||
|
|
visitor.VisitDefaultExpression(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
||
|
|
{
|
||
|
|
return visitor.VisitDefaultExpression(this);
|
||
|
|
}
|
||
|
|
|
||
|
|
public DefaultExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, TypeSyntax type, SyntaxToken closeParenToken)
|
||
|
|
{
|
||
|
|
//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_0037: 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_0025: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
if (keyword != Keyword || openParenToken != OpenParenToken || type != Type || closeParenToken != CloseParenToken)
|
||
|
|
{
|
||
|
|
DefaultExpressionSyntax defaultExpressionSyntax = SyntaxFactory.DefaultExpression(keyword, openParenToken, type, closeParenToken);
|
||
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
||
|
|
if (annotations == null || annotations.Length == 0)
|
||
|
|
{
|
||
|
|
return defaultExpressionSyntax;
|
||
|
|
}
|
||
|
|
return defaultExpressionSyntax.WithAnnotations(annotations);
|
||
|
|
}
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
public DefaultExpressionSyntax WithKeyword(SyntaxToken keyword)
|
||
|
|
{
|
||
|
|
//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_000f: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(keyword, OpenParenToken, Type, CloseParenToken);
|
||
|
|
}
|
||
|
|
|
||
|
|
public DefaultExpressionSyntax WithOpenParenToken(SyntaxToken openParenToken)
|
||
|
|
{
|
||
|
|
//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_000f: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(Keyword, openParenToken, Type, CloseParenToken);
|
||
|
|
}
|
||
|
|
|
||
|
|
public DefaultExpressionSyntax WithType(TypeSyntax type)
|
||
|
|
{
|
||
|
|
//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_000f: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(Keyword, OpenParenToken, type, CloseParenToken);
|
||
|
|
}
|
||
|
|
|
||
|
|
public DefaultExpressionSyntax WithCloseParenToken(SyntaxToken closeParenToken)
|
||
|
|
{
|
||
|
|
//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_0013: Unknown result type (might be due to invalid IL or missing references)
|
||
|
|
return Update(Keyword, OpenParenToken, Type, closeParenToken);
|
||
|
|
}
|
||
|
|
}
|