93 lines
3.3 KiB
C#
93 lines
3.3 KiB
C#
using System.Collections.Generic;
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax;
|
|
|
|
namespace Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
public sealed class FinallyClauseSyntax : CSharpSyntaxNode
|
|
{
|
|
private BlockSyntax? block;
|
|
|
|
public SyntaxToken FinallyKeyword => new SyntaxToken((SyntaxNode)(object)this, (GreenNode)(object)((Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.FinallyClauseSyntax)(object)((SyntaxNode)this).Green).finallyKeyword, ((SyntaxNode)this).Position, 0);
|
|
|
|
public BlockSyntax Block => ((SyntaxNode)this).GetRed<BlockSyntax>(ref block, 1);
|
|
|
|
internal FinallyClauseSyntax(Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CSharpSyntaxNode green, SyntaxNode? parent, int position)
|
|
: base((GreenNode)(object)green, parent, position)
|
|
{
|
|
}
|
|
|
|
internal override SyntaxNode? GetNodeSlot(int index)
|
|
{
|
|
if (index != 1)
|
|
{
|
|
return null;
|
|
}
|
|
return (SyntaxNode?)(object)((SyntaxNode)this).GetRed<BlockSyntax>(ref block, 1);
|
|
}
|
|
|
|
internal override SyntaxNode? GetCachedSlot(int index)
|
|
{
|
|
if (index != 1)
|
|
{
|
|
return null;
|
|
}
|
|
return (SyntaxNode?)(object)block;
|
|
}
|
|
|
|
public override void Accept(CSharpSyntaxVisitor visitor)
|
|
{
|
|
visitor.VisitFinallyClause(this);
|
|
}
|
|
|
|
public override TResult? Accept<TResult>(CSharpSyntaxVisitor<TResult> visitor)
|
|
{
|
|
return visitor.VisitFinallyClause(this);
|
|
}
|
|
|
|
public FinallyClauseSyntax Update(SyntaxToken finallyKeyword, 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_0017: Unknown result type (might be due to invalid IL or missing references)
|
|
if (finallyKeyword != FinallyKeyword || block != Block)
|
|
{
|
|
FinallyClauseSyntax finallyClauseSyntax = SyntaxFactory.FinallyClause(finallyKeyword, block);
|
|
SyntaxAnnotation[] annotations = ((SyntaxNode)this).GetAnnotations();
|
|
if (annotations == null || annotations.Length == 0)
|
|
{
|
|
return finallyClauseSyntax;
|
|
}
|
|
return finallyClauseSyntax.WithAnnotations(annotations);
|
|
}
|
|
return this;
|
|
}
|
|
|
|
public FinallyClauseSyntax WithFinallyKeyword(SyntaxToken finallyKeyword)
|
|
{
|
|
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(finallyKeyword, Block);
|
|
}
|
|
|
|
public FinallyClauseSyntax WithBlock(BlockSyntax block)
|
|
{
|
|
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
|
|
return Update(FinallyKeyword, block);
|
|
}
|
|
|
|
public FinallyClauseSyntax 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 FinallyClauseSyntax 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)));
|
|
}
|
|
}
|