Class CilGraphNodeMutable
A mutable version of CilGraphNode class
Inherited Members
Namespace: CilTools.BytecodeAnalysis
Assembly: CilTools.BytecodeAnalysis.dll
Syntax
public class CilGraphNodeMutable : CilGraphNode
Remarks
Graph nodes are exposed as immutable CilGraphNode objects by API of this library, such as Create(MethodBase) method, because usually you don't need to alter their properties. However, these nodes are created as mutable objects and their actual runtime type is CilGraphNodeMutable; you can cast them to that type if you need to set their properties.
Constructors
CilGraphNodeMutable(CilInstruction)
Creates new mutable CIL graph node object
Declaration
public CilGraphNodeMutable(CilInstruction instr)
Parameters
Type | Name | Description |
---|---|---|
CilInstruction | instr | An instruction associated with this node |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | instr argument is null |
Properties
BranchTarget
Gets or sets a reference to the node that represents instruction which is a target of the current instruction, if applicable
Declaration
public CilGraphNode BranchTarget { get; set; }
Property Value
Type | Description |
---|---|
CilGraphNode |
Remarks
Branch target is an instruction which would be called after current one if the condition for jump instruction is met. For non-jump instructions, the value is null.
Instruction
Gets or sets CIL instruction associated with this node
Declaration
public CilInstruction Instruction { get; set; }
Property Value
Type | Description |
---|---|
CilInstruction |
Name
Gets or sets label name associated with this node
Declaration
public string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Label names are assigned to instruction that serve as branch targets for convenience. If the instruction is not used as target, the value is empty string.
Next
Gets or sets a reference to the node that represents instruction directly following current instruction in the method bytecode
Declaration
public CilGraphNode Next { get; set; }
Property Value
Type | Description |
---|---|
CilGraphNode |
Remarks
Next instruction will be normally executed after current one, unless it is a jump instruction and the condition for jump is met. For the last instruction of the method body, the value is null.
Previous
Gets or sets a reference to the node that represents instruction directly preceding current instruction in the method bytecode
Declaration
public CilGraphNode Previous { get; set; }
Property Value
Type | Description |
---|---|
CilGraphNode |
Remarks
For the first instruction in the method body, the value is null.
Methods
SetSwitchTargets(CilGraphNode[])
Sets the array of nodes that represents the jump table of the switch instruction
Declaration
public void SetSwitchTargets(CilGraphNode[] newtargets)
Parameters
Type | Name | Description |
---|---|---|
CilGraphNode[] | newtargets |
Remarks
Jump table is the sequence of instructions corresponding to the switch instruction. When runtime processes switch instruction, it will transfer control to one of the instructions based on the value pushed to the stack.