137 lines
5.6 KiB
C#
137 lines
5.6 KiB
C#
using System.Collections.Generic;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class UnsafeStatementSyntax : StatementSyntax
|
|
{
|
|
private SyntaxNode? attributeLists;
|
|
|
|
private BlockSyntax? block;
|
|
|
|
public override SyntaxList<AttributeListSyntax> AttributeLists => new SyntaxList<AttributeListSyntax>(((SyntaxNode)this).GetRed(ref attributeLists, 0));
|
|
|
|
public SyntaxToken UnsafeKeyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.UnsafeStatementSyntax)(object)((SyntaxNode)this).Green).unsafeKeyword, ((SyntaxNode)this).GetChildPosition(1), ((SyntaxNode)this).GetChildIndex(1));
|
|
|
|
public BlockSyntax Block => ((SyntaxNode)this).GetRed<BlockSyntax>(ref block, 2);
|
|
|
|
public UnsafeStatementSyntax Update(SyntaxToken unsafeKeyword, BlockSyntax block)
|
|
{
|
|
//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)
|
|
return Update(AttributeLists, unsafeKeyword, block);
|
|
}
|
|
|
|
internal UnsafeStatementSyntax(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(ref attributeLists),
|
|
2 => ((SyntaxNode)this).GetRed<BlockSyntax>(ref block, 2),
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
return (SyntaxNode?)(index switch
|
|
{
|
|
0 => attributeLists,
|
|
2 => block,
|
|
_ => null,
|
|
});
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitUnsafeStatement(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitUnsafeStatement(this);
|
|
}
|
|
|
|
public UnsafeStatementSyntax Update(SyntaxList<AttributeListSyntax> attributeLists, SyntaxToken unsafeKeyword, BlockSyntax block)
|
|
{
|
|
//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_0025: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0026: 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)
|
|
if (attributeLists != AttributeLists || unsafeKeyword != UnsafeKeyword || block != Block)
|
|
{
|
|
UnsafeStatementSyntax unsafeStatementSyntax = SyntaxFactory.UnsafeStatement(attributeLists, unsafeKeyword, block);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return unsafeStatementSyntax;
|
|
}
|
|
return unsafeStatementSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
internal override StatementSyntax WithAttributeListsCore(SyntaxList<AttributeListSyntax> attributeLists)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithAttributeLists(attributeLists);
|
|
}
|
|
|
|
public new UnsafeStatementSyntax WithAttributeLists(SyntaxList<AttributeListSyntax> attributeLists)
|
|
{
|
|
//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)
|
|
return Update(attributeLists, UnsafeKeyword, Block);
|
|
}
|
|
|
|
public UnsafeStatementSyntax WithUnsafeKeyword(SyntaxToken unsafeKeyword)
|
|
{
|
|
//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)
|
|
return Update(AttributeLists, unsafeKeyword, Block);
|
|
}
|
|
|
|
public UnsafeStatementSyntax WithBlock(BlockSyntax block)
|
|
{
|
|
//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)
|
|
return Update(AttributeLists, UnsafeKeyword, block);
|
|
}
|
|
|
|
internal override StatementSyntax AddAttributeListsCore(params AttributeListSyntax[] items)
|
|
{
|
|
return AddAttributeLists(items);
|
|
}
|
|
|
|
public new UnsafeStatementSyntax AddAttributeLists(params AttributeListSyntax[] items)
|
|
{
|
|
//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_000b: Unknown result type (might be due to invalid IL or missing references)
|
|
return WithAttributeLists(AttributeLists.AddRange((IEnumerable<AttributeListSyntax>)items));
|
|
}
|
|
|
|
public UnsafeStatementSyntax AddBlockAttributeLists(params AttributeListSyntax[] items)
|
|
{
|
|
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0012: 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)
|
|
return WithBlock(Block.WithAttributeLists(Block.AttributeLists.AddRange((IEnumerable<AttributeListSyntax>)items)));
|
|
}
|
|
|
|
public UnsafeStatementSyntax AddBlockStatements(params StatementSyntax[] items)
|
|
{
|
|
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
|
|
//IL_0012: 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)
|
|
return WithBlock(Block.WithStatements(Block.Statements.AddRange((IEnumerable<StatementSyntax>)items)));
|
|
}
|
|
}
|