Class BlockContainer
- Namespace
- ICSharpCode.Decompiler.IL
- Assembly
- ICSharpCode.Decompiler.dll
A container of IL blocks.
public sealed class BlockContainer : ILInstruction
- Inheritance
-
BlockContainer
- Inherited Members
Constructors
BlockContainer(ContainerKind, StackType)
public BlockContainer(ContainerKind kind = ContainerKind.Normal, StackType expectedResultType = StackType.Void)
Parameters
kind
ContainerKindexpectedResultType
StackType
Fields
BlockSlot
public static readonly SlotInfo BlockSlot
Field Value
Blocks
public readonly InstructionCollection<Block> Blocks
Field Value
Properties
DirectFlags
Gets the flags for this instruction only, without considering the child instructions.
public override InstructionFlags DirectFlags { get; }
Property Value
EntryPoint
Gets the container's entry point. This is the first block in the Blocks collection.
public Block EntryPoint { get; }
Property Value
ExpectedResultType
public StackType ExpectedResultType { get; set; }
Property Value
Kind
public ContainerKind Kind { get; set; }
Property Value
LeaveCount
Gets the number of 'leave' instructions that target this BlockContainer.
public int LeaveCount { get; }
Property Value
ResultType
Gets the stack type of the value produced by this instruction.
public override StackType ResultType { get; }
Property Value
Methods
AcceptVisitor(ILVisitor)
Calls the Visit*-method on the visitor corresponding to the concrete type of this instruction.
public override void AcceptVisitor(ILVisitor visitor)
Parameters
visitor
ILVisitor
AcceptVisitor<T>(ILVisitor<T>)
Calls the Visit*-method on the visitor corresponding to the concrete type of this instruction.
public override T AcceptVisitor<T>(ILVisitor<T> visitor)
Parameters
visitor
ILVisitor<T>
Returns
- T
Type Parameters
T
AcceptVisitor<C, T>(ILVisitor<C, T>, C)
Calls the Visit*-method on the visitor corresponding to the concrete type of this instruction.
public override T AcceptVisitor<C, T>(ILVisitor<C, T> visitor, C context)
Parameters
visitor
ILVisitor<C, T>context
C
Returns
- T
Type Parameters
C
T
Clone()
public override ILInstruction Clone()
Returns
ComputeFlags()
protected override InstructionFlags ComputeFlags()
Returns
Connected()
Called after the ILInstruction was connected to the root node of the ILAst.
protected override void Connected()
Disconnected()
Called after the ILInstruction was disconnected from the root node of the ILAst.
protected override void Disconnected()
FindClosestContainer(ILInstruction?)
public static BlockContainer? FindClosestContainer(ILInstruction? inst)
Parameters
inst
ILInstruction
Returns
FindClosestSwitchContainer(ILInstruction?)
public static BlockContainer? FindClosestSwitchContainer(ILInstruction? inst)
Parameters
inst
ILInstruction
Returns
GetChild(int)
protected override ILInstruction GetChild(int index)
Parameters
index
int
Returns
GetChildCount()
protected override int GetChildCount()
Returns
GetChildSlot(int)
protected override SlotInfo GetChildSlot(int index)
Parameters
index
int
Returns
InstructionCollectionUpdateComplete()
Called when a series of add/remove operations on the InstructionCollection is complete.
protected override void InstructionCollectionUpdateComplete()
MatchConditionBlock(Block, out ILInstruction?, out Block?)
public bool MatchConditionBlock(Block block, out ILInstruction? condition, out Block? bodyStartBlock)
Parameters
block
Blockcondition
ILInstructionbodyStartBlock
Block
Returns
MatchIncrementBlock(Block)
public bool MatchIncrementBlock(Block block)
Parameters
block
Block
Returns
PerformMatch(ILInstruction?, ref Match)
protected override bool PerformMatch(ILInstruction? other, ref Match match)
Parameters
other
ILInstructionmatch
Match
Returns
SetChild(int, ILInstruction?)
protected override void SetChild(int index, ILInstruction? value)
Parameters
index
intvalue
ILInstruction
SingleInstruction()
If the container consists of a single block with a single instruction, returns that instruction. Otherwise returns the block, or the container itself if it has multiple blocks.
public ILInstruction SingleInstruction()
Returns
SortBlocks(bool)
Topologically sort the blocks.
public void SortBlocks(bool deleteUnreachableBlocks = false)
Parameters
deleteUnreachableBlocks
boolIf true, delete unreachable blocks.
TopologicalSort(bool)
Topologically sort the blocks. The new order is returned without modifying the BlockContainer.
public List<Block> TopologicalSort(bool deleteUnreachableBlocks = false)
Parameters
deleteUnreachableBlocks
boolIf true, unreachable blocks are not included in the new order.
Returns
WriteTo(ITextOutput, ILAstWritingOptions)
Writes the ILAst to the text output.
public override void WriteTo(ITextOutput output, ILAstWritingOptions options)
Parameters
output
ITextOutputoptions
ILAstWritingOptions