Table of Contents

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 ContainerKind
expectedResultType StackType

Fields

BlockSlot

public static readonly SlotInfo BlockSlot

Field Value

SlotInfo

Blocks

public readonly InstructionCollection<Block> Blocks

Field Value

InstructionCollection<Block>

Properties

DirectFlags

Gets the flags for this instruction only, without considering the child instructions.

public override InstructionFlags DirectFlags { get; }

Property Value

InstructionFlags

EntryPoint

Gets the container's entry point. This is the first block in the Blocks collection.

public Block EntryPoint { get; }

Property Value

Block

ExpectedResultType

public StackType ExpectedResultType { get; set; }

Property Value

StackType

Kind

public ContainerKind Kind { get; set; }

Property Value

ContainerKind

LeaveCount

Gets the number of 'leave' instructions that target this BlockContainer.

public int LeaveCount { get; }

Property Value

int

ResultType

Gets the stack type of the value produced by this instruction.

public override StackType ResultType { get; }

Property Value

StackType

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

ILInstruction

ComputeFlags()

protected override InstructionFlags ComputeFlags()

Returns

InstructionFlags

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

BlockContainer

FindClosestSwitchContainer(ILInstruction?)

public static BlockContainer? FindClosestSwitchContainer(ILInstruction? inst)

Parameters

inst ILInstruction

Returns

BlockContainer

GetChild(int)

protected override ILInstruction GetChild(int index)

Parameters

index int

Returns

ILInstruction

GetChildCount()

protected override int GetChildCount()

Returns

int

GetChildSlot(int)

protected override SlotInfo GetChildSlot(int index)

Parameters

index int

Returns

SlotInfo

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 Block
condition ILInstruction
bodyStartBlock Block

Returns

bool

MatchIncrementBlock(Block)

public bool MatchIncrementBlock(Block block)

Parameters

block Block

Returns

bool

PerformMatch(ILInstruction?, ref Match)

protected override bool PerformMatch(ILInstruction? other, ref Match match)

Parameters

other ILInstruction
match Match

Returns

bool

SetChild(int, ILInstruction?)

protected override void SetChild(int index, ILInstruction? value)

Parameters

index int
value 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

ILInstruction

SortBlocks(bool)

Topologically sort the blocks.

public void SortBlocks(bool deleteUnreachableBlocks = false)

Parameters

deleteUnreachableBlocks bool

If 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 bool

If true, unreachable blocks are not included in the new order.

Returns

List<Block>

WriteTo(ITextOutput, ILAstWritingOptions)

Writes the ILAst to the text output.

public override void WriteTo(ITextOutput output, ILAstWritingOptions options)

Parameters

output ITextOutput
options ILAstWritingOptions