Table of Contents

Class Leave

Namespace
ICSharpCode.Decompiler.IL
Assembly
ICSharpCode.Decompiler.dll

Unconditional branch to end of block container. Return is represented using IsLeavingFunction and an (optional) return value. The block container evaluates to the value produced by the argument of the leave instruction.

public sealed class Leave : ILInstruction
Inheritance
Leave
Inherited Members

Remarks

When jumping to the entrypoint of the current block container, the branch represents a continue statement.

Phase-1 execution of a branch is a no-op. Phase-2 execution removes PopCount elements from the evaluation stack and jumps to the target block.

Constructors

Leave(BlockContainer?, ILInstruction?)

public Leave(BlockContainer? targetContainer, ILInstruction? value = null)

Parameters

targetContainer BlockContainer
value ILInstruction

Fields

ValueSlot

public static readonly SlotInfo ValueSlot

Field Value

SlotInfo

Properties

DirectFlags

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

public override InstructionFlags DirectFlags { get; }

Property Value

InstructionFlags

IsLeavingFunction

Gets whether the leave instruction is directly leaving the whole ILFunction. (TargetContainer == main container of the function).

This is only valid for functions returning void (representing value-less "return;"), and for iterators (representing "yield break;").

Note: returns false for leave instructions that indirectly leave the function (e.g. leaving a try block, and the try-finally construct is immediately followed by another leave instruction)

public bool IsLeavingFunction { get; }

Property Value

bool

ResultType

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

public override StackType ResultType { get; }

Property Value

StackType

TargetContainer

public BlockContainer TargetContainer { get; set; }

Property Value

BlockContainer

TargetLabel

public string TargetLabel { get; }

Property Value

string

TriggersFinallyBlock

Gets whether this branch executes at least one finally block before jumping to the end of the target block container.

public bool TriggersFinallyBlock { get; }

Property Value

bool

Value

public ILInstruction Value { get; set; }

Property Value

ILInstruction

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 sealed 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()

GetChild(int)

protected override sealed ILInstruction GetChild(int index)

Parameters

index int

Returns

ILInstruction

GetChildCount()

protected override sealed int GetChildCount()

Returns

int

GetChildSlot(int)

protected override sealed SlotInfo GetChildSlot(int index)

Parameters

index int

Returns

SlotInfo

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 sealed void SetChild(int index, ILInstruction value)

Parameters

index int
value ILInstruction

WriteTo(ITextOutput, ILAstWritingOptions)

Writes the ILAst to the text output.

public override void WriteTo(ITextOutput output, ILAstWritingOptions options)

Parameters

output ITextOutput
options ILAstWritingOptions