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
Methods
DeclareLocal(Type)
Declares a new local variable in the method body.
LocalRef DeclareLocal(Type type)
Parameters
typeTypeThe local's type.
Returns
- LocalRef
A handle usable as the operand of a load or store instruction.
Exceptions
- ConcordEmitException
Thrown with code
CONC116whentypeis 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
indexintThe local's slot index.
Returns
- LocalRef
A handle usable as the operand of a load or store instruction.
Exceptions
- ConcordEmitException
Thrown with code
CONC121whenindexis out of range.