C# Класс Gendarme.Framework.Rocks.InstructionRocks

InstructionRocks contains extensions methods for Instruction and the related collection classes.
Показать файл Открыть проект

Открытые методы

Метод Описание
GetField ( this self ) : FieldDefinition

Get the FieldDefinition associated with the Instruction.

GetMethod ( this self ) : MethodReference

Get the MethodReference or MethodDefinition (but not a CallSite) associated with the Instruction

Older (pre 0.9) Cecil CallSite did not inherit from MethodReference so this was not an issue

GetOperand ( this self, Mono.Cecil.MethodDefinition method ) : object

Return the operand of the Instruction. For macro instruction the operand is constructed.

GetOperandType ( this self, Mono.Cecil.MethodDefinition method ) : TypeReference

Return the type associated with the instruction's operand (INCOMPLETE).

GetParameter ( this self, Mono.Cecil.MethodDefinition method ) : Mono.Cecil.ParameterDefinition

Get the ParameterDefinition associated with the Instruction.

GetPopCount ( this self, IMethodSignature method ) : int

Get the number of values removed on the stack for this instruction.

GetPushCount ( this self ) : int

Get the number of values placed on the stack by this instruction.

GetVariable ( this self, Mono.Cecil.MethodDefinition method ) : Mono.Cecil.Cil.VariableDefinition

Get the VariableDefinition associated with the Instruction.

Is ( this self, Code code ) : bool

Helper method to avoid patterns like "ins.Previous != null && ins.Previous.OpCode.Code == Code.Newobj" and replace it with a shorter "ins.Previous.Is (Code.Newobj)".

IsLoadArgument ( this self ) : bool

Return if the Instruction is a load of an argument (ldarg* family).

IsLoadElement ( this self ) : bool

Return if the Instruction is the load of an element (ldelem* family)

IsLoadIndirect ( this self ) : bool

Return if the Instruction is a load indirect (ldind* family)

IsLoadLocal ( this self ) : bool

Return if the Instruction is a load of a local variable (ldloc* family).

IsOperandZero ( this self ) : bool

Determine if the instruction operand contains the constant zero (0).

IsStoreArgument ( this self ) : bool

Return if the Instruction is a store of an argument (starg* family).

IsStoreLocal ( this self ) : bool

Return if the Instruction is a store of a local variable (stloc* family).

TraceBack ( this self, IMethodSignature method ) : Instruction

Return the instruction that match the current instruction. This is computed by substracting push and adding pop counts until the total becomes zero.

TraceBack ( this self, IMethodSignature method, int offset ) : Instruction

Return the instruction that match the current instruction. This is computed by substracting push and adding pop counts until the total becomes zero.

Описание методов

GetField() публичный статический Метод

Get the FieldDefinition associated with the Instruction.
public static GetField ( this self ) : FieldDefinition
self this The Instruction on which the extension method can be called.
Результат Mono.Cecil.FieldDefinition

GetMethod() публичный статический Метод

Get the MethodReference or MethodDefinition (but not a CallSite) associated with the Instruction
Older (pre 0.9) Cecil CallSite did not inherit from MethodReference so this was not an issue
public static GetMethod ( this self ) : MethodReference
self this The Instruction on which the extension method can be called.
Результат Mono.Cecil.MethodReference

GetOperand() публичный статический Метод

Return the operand of the Instruction. For macro instruction the operand is constructed.
public static GetOperand ( this self, Mono.Cecil.MethodDefinition method ) : object
self this The Instruction on which the extension method can be called.
method Mono.Cecil.MethodDefinition The method inside which the instruction comes from.
Результат object

GetOperandType() публичный статический Метод

Return the type associated with the instruction's operand (INCOMPLETE).
public static GetOperandType ( this self, Mono.Cecil.MethodDefinition method ) : TypeReference
self this The Instruction on which the extension method can be called.
method Mono.Cecil.MethodDefinition The method inside which the instruction comes from.
Результат Mono.Cecil.TypeReference

GetParameter() публичный статический Метод

Get the ParameterDefinition associated with the Instruction.
public static GetParameter ( this self, Mono.Cecil.MethodDefinition method ) : Mono.Cecil.ParameterDefinition
self this The Instruction on which the extension method can be called.
method Mono.Cecil.MethodDefinition The method inside which the instruction comes from. /// Needed for the macro instruction where only the variable index is available.
Результат Mono.Cecil.ParameterDefinition

GetPopCount() публичный статический Метод

Get the number of values removed on the stack for this instruction.
public static GetPopCount ( this self, IMethodSignature method ) : int
self this The Instruction on which the extension method can be called.
method IMethodSignature The method inside which the instruction comes from /// (needed for StackBehaviour.Varpop).
Результат int

GetPushCount() публичный статический Метод

Get the number of values placed on the stack by this instruction.
public static GetPushCount ( this self ) : int
self this The Instruction on which the extension method can be called.
Результат int

GetVariable() публичный статический Метод

Get the VariableDefinition associated with the Instruction.
public static GetVariable ( this self, Mono.Cecil.MethodDefinition method ) : Mono.Cecil.Cil.VariableDefinition
self this The Instruction on which the extension method can be called.
method Mono.Cecil.MethodDefinition The method inside which the instruction comes from. /// Needed for the macro instruction where only the variable index is available.
Результат Mono.Cecil.Cil.VariableDefinition

Is() публичный статический Метод

Helper method to avoid patterns like "ins.Previous != null && ins.Previous.OpCode.Code == Code.Newobj" and replace it with a shorter "ins.Previous.Is (Code.Newobj)".
public static Is ( this self, Code code ) : bool
self this The Instruction on which the extension method can be called.
code Code The Code to compare to.
Результат bool

IsLoadArgument() публичный статический Метод

Return if the Instruction is a load of an argument (ldarg* family).
public static IsLoadArgument ( this self ) : bool
self this The Instruction on which the extension method can be called.
Результат bool

IsLoadElement() публичный статический Метод

Return if the Instruction is the load of an element (ldelem* family)
public static IsLoadElement ( this self ) : bool
self this The Instruction on which the extension method can be called.
Результат bool

IsLoadIndirect() публичный статический Метод

Return if the Instruction is a load indirect (ldind* family)
public static IsLoadIndirect ( this self ) : bool
self this The Instruction on which the extension method can be called.
Результат bool

IsLoadLocal() публичный статический Метод

Return if the Instruction is a load of a local variable (ldloc* family).
public static IsLoadLocal ( this self ) : bool
self this The Instruction on which the extension method can be called.
Результат bool

IsOperandZero() публичный статический Метод

Determine if the instruction operand contains the constant zero (0).
public static IsOperandZero ( this self ) : bool
self this The Instruction on which the extension method can be called.
Результат bool

IsStoreArgument() публичный статический Метод

Return if the Instruction is a store of an argument (starg* family).
public static IsStoreArgument ( this self ) : bool
self this The Instruction on which the extension method can be called.
Результат bool

IsStoreLocal() публичный статический Метод

Return if the Instruction is a store of a local variable (stloc* family).
public static IsStoreLocal ( this self ) : bool
self this The Instruction on which the extension method can be called.
Результат bool

TraceBack() публичный статический Метод

Return the instruction that match the current instruction. This is computed by substracting push and adding pop counts until the total becomes zero.
public static TraceBack ( this self, IMethodSignature method ) : Instruction
self this The Instruction on which the extension method can be called.
method IMethodSignature The method from which the instruction was extracted.
Результат Mono.Cecil.Cil.Instruction

TraceBack() публичный статический Метод

Return the instruction that match the current instruction. This is computed by substracting push and adding pop counts until the total becomes zero.
public static TraceBack ( this self, IMethodSignature method, int offset ) : Instruction
self this The Instruction on which the extension method can be called.
method IMethodSignature The method from which the instruction was extracted.
offset int Offset to add the the Pop count. Useful to track several parameters to a method.
Результат Mono.Cecil.Cil.Instruction