Class CodeInstruction
An abstract wrapper around OpCode and their operands. Used by transpilers
Inheritance
Inherited Members
Namespace: HarmonyLib
Assembly: 0Harmony.dll
Syntax
public class CodeInstruction
Constructors
| Improve this Doc View SourceCodeInstruction(CodeInstruction)
Create a full copy (including labels and exception blocks) of a CodeInstruction
Declaration
public CodeInstruction(CodeInstruction instruction)
Parameters
| Type | Name | Description |
|---|---|---|
| CodeInstruction | instruction | The instruction to copy |
CodeInstruction(OpCode, Object)
Creates a new CodeInstruction with a given opcode and optional operand
Declaration
public CodeInstruction(OpCode opcode, object operand = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Reflection.Emit.OpCode | opcode | The code |
| System.Object | operand | The operand |
Fields
| Improve this Doc View Sourceblocks
All exception block boundaries defined on this instruction
Declaration
public List<ExceptionBlock> blocks
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<ExceptionBlock> |
labels
All labels defined on this instruction
Declaration
public List<Label> labels
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Reflection.Emit.Label> |
opcode
The opcode
Declaration
public OpCode opcode
Field Value
| Type | Description |
|---|---|
| System.Reflection.Emit.OpCode |
operand
The operand
Declaration
public object operand
Field Value
| Type | Description |
|---|---|
| System.Object |
Methods
| Improve this Doc View SourceClone()
Clones a CodeInstruction and resets its labels and exception blocks
Declaration
public CodeInstruction Clone()
Returns
| Type | Description |
|---|---|
| CodeInstruction | A lightweight copy of this code instruction |
Clone(Object)
Clones a CodeInstruction, resets labels and exception blocks and sets its operand
Declaration
public CodeInstruction Clone(object operand)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | operand | The opcode |
Returns
| Type | Description |
|---|---|
| CodeInstruction | A copy of this CodeInstruction with a new operand |
Clone(OpCode)
Clones a CodeInstruction, resets labels and exception blocks and sets its opcode
Declaration
public CodeInstruction Clone(OpCode opcode)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Reflection.Emit.OpCode | opcode | The opcode |
Returns
| Type | Description |
|---|---|
| CodeInstruction | A copy of this CodeInstruction with a new opcode |
ToString()
Returns a string representation of the code instruction
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | A string representation of the code instruction |