106 lines
4.9 KiB
C#
106 lines
4.9 KiB
C#
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class CheckedExpressionSyntax : ExpressionSyntax
|
|
{
|
|
private ExpressionSyntax? expression;
|
|
|
|
public SyntaxToken Keyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CheckedExpressionSyntax)(object)((SyntaxNode)this).Green).keyword, ((SyntaxNode)this).Position, 0);
|
|
|
|
public SyntaxToken OpenParenToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CheckedExpressionSyntax)(object)((SyntaxNode)this).Green).openParenToken, ((SyntaxNode)this).GetChildPosition(1), ((SyntaxNode)this).GetChildIndex(1));
|
|
|
|
public ExpressionSyntax Expression => ((SyntaxNode)this).GetRed<ExpressionSyntax>(ref expression, 2);
|
|
|
|
public SyntaxToken CloseParenToken => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CheckedExpressionSyntax)(object)((SyntaxNode)this).Green).closeParenToken, ((SyntaxNode)this).GetChildPosition(3), ((SyntaxNode)this).GetChildIndex(3));
|
|
|
|
internal CheckedExpressionSyntax(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<ExpressionSyntax>(ref expression, 2);
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
if (index != 2)
|
|
{
|
|
return null;
|
|
}
|
|
return (SyntaxNode?)(object)expression;
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitCheckedExpression(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitCheckedExpression(this);
|
|
}
|
|
|
|
public CheckedExpressionSyntax Update(SyntaxToken keyword, SyntaxToken openParenToken, ExpressionSyntax expression, 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_003a: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_003d: 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 || expression != Expression || closeParenToken != CloseParenToken)
|
|
{
|
|
CheckedExpressionSyntax checkedExpressionSyntax = SyntaxFactory.CheckedExpression(Kind(), keyword, openParenToken, expression, closeParenToken);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return checkedExpressionSyntax;
|
|
}
|
|
return checkedExpressionSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public CheckedExpressionSyntax 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, Expression, CloseParenToken);
|
|
}
|
|
|
|
public CheckedExpressionSyntax 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, Expression, CloseParenToken);
|
|
}
|
|
|
|
public CheckedExpressionSyntax WithExpression(ExpressionSyntax expression)
|
|
{
|
|
//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, expression, CloseParenToken);
|
|
}
|
|
|
|
public CheckedExpressionSyntax 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, Expression, closeParenToken);
|
|
}
|
|
}
|