Skip to content
Concord

Interface ITranspilerContext

Namespace
Concord
Assembly
Concord.Emit.dll

Services available to a transpiler while it rewrites a method body: the method being patched, plus factories for new branch targets and local variables.

public interface ITranspilerContext

Properties

Original

The method being patched, after async and iterator state-machine resolution.

MethodBase Original { get; }

Property Value

MethodBase

Methods

DeclareLocal(Type)

Declares a new local variable in the method body.

LocalRef DeclareLocal(Type type)

Parameters

type Type

The local's type.

Returns

LocalRef

A handle usable as the operand of a load or store instruction.

Exceptions

ConcordEmitException

Thrown with code CONC116 when type is null.

DefineLabel()

Mints a new branch target. Attach it to an instruction's labels to fix its position.

Label DefineLabel()

Returns

Label

A label that no instruction carries yet.

GetLocal(int)

Gets a handle to a local the body already declares, by slot index. Use this to reference a local the target computed, where a Harmony transpiler would have written a bare slot number such as Ldloc_S, 4. Transpiler-declared locals follow the body's own.

LocalRef GetLocal(int index)

Parameters

index int

The local's slot index.

Returns

LocalRef

A handle usable as the operand of a load or store instruction.

Exceptions

ConcordEmitException

Thrown with code CONC121 when index is out of range.