C# Class Cilador.Clone.CloningExtensions

Extension methods used for cloning
Show file Open project: rileywhite/Cilador

Public Methods

Method Description
ApplyLocalVariableTranslation ( this instruction, int translate, IEnumerable variables ) : Instruction

Examines the instruction and, if it accesses a local variable, provides a new version that translates the access by the given count.

If the instruction does not reference a local variable or if the translation is zero, then the original instruction will be returned. Likewise, if the instruction operand is a VariableDefinition and the translation doesn't cause the opcode to change (e.g. from stloc_S to stloc), then the original instruction is returned.

CloneAll ( object>.this cloners ) : void

Invokes clone on each item

IsLoadVariableAddressOpCode ( this code ) : bool

Determines whether in instruction opcode loads a variable address.

IsLoadVariableOpCode ( this code ) : bool

Determines whether in instruction opcode loads a variable.

IsStoreVariableOpCode ( this code ) : bool

Determines whether in instruction opcode stores a variable.

TryGetVariableIndex ( this instruction, int &variableIndex ) : bool

Tries to find the index of a variable referenced by an instruction, if any.

Private Methods

Method Description
IsNestedWithin ( this type, Mono.Cecil.TypeDefinition possibleAncestorType ) : bool
SignatureEquals ( this target, MethodReference source, ICloningContext cloningContext ) : bool

Method Details

ApplyLocalVariableTranslation() public static method

Examines the instruction and, if it accesses a local variable, provides a new version that translates the access by the given count.
If the instruction does not reference a local variable or if the translation is zero, then the original instruction will be returned. Likewise, if the instruction operand is a VariableDefinition and the translation doesn't cause the opcode to change (e.g. from stloc_S to stloc), then the original instruction is returned.
public static ApplyLocalVariableTranslation ( this instruction, int translate, IEnumerable variables ) : Instruction
instruction this Instruction to look at.
translate int How to translate the referenced parameter, if any is referenced. Negative is a left translation, and positive is right.
variables IEnumerable Collection of variables that may be referenced.
return Mono.Cecil.Cil.Instruction

CloneAll() public static method

Invokes clone on each item
public static CloneAll ( object>.this cloners ) : void
cloners object>.this
return void

IsLoadVariableAddressOpCode() public static method

Determines whether in instruction opcode loads a variable address.
public static IsLoadVariableAddressOpCode ( this code ) : bool
code this OpCode's CIL code
return bool

IsLoadVariableOpCode() public static method

Determines whether in instruction opcode loads a variable.
public static IsLoadVariableOpCode ( this code ) : bool
code this OpCode's CIL code
return bool

IsStoreVariableOpCode() public static method

Determines whether in instruction opcode stores a variable.
public static IsStoreVariableOpCode ( this code ) : bool
code this OpCode's CIL code
return bool

TryGetVariableIndex() public static method

Tries to find the index of a variable referenced by an instruction, if any.
public static TryGetVariableIndex ( this instruction, int &variableIndex ) : bool
instruction this Instruction to examine.
variableIndex int Index to populate, if found.
return bool