C# 클래스 LinFu.Reflection.Emit.CilWorkerExtensions

A class that extends the CilWorker class with helper methods that make it easier to save information about the method currently being implemented.
파일 보기 프로젝트 열기: philiplaureano/LinFu

공개 메소드들

메소드 설명
EmitWriteLine ( this IL, string text ) : void

Emits a Console.WriteLine call using the current CilWorker.

EmitWriteLineIfNull ( this IL, string text, Mono.Cecil.Cil.VariableDefinition targetVariable ) : void

Emits a Console.WriteLine call to using the current CilWorker that will only be called if the contents of the target variable are null at runtime.

GetDeclaringType ( this method ) : TypeReference

Gets the declaring type for the target method.

GetMethod ( this IL ) : Mono.Cecil.MethodDefinition

Obtains the method definition that contains the current CilWorker.

GetModule ( this IL ) : Mono.Cecil.ModuleDefinition

Obtains the module that contains the current CilWorker.

PackageReturnValue ( this IL, Mono.Cecil.ModuleDefinition module, TypeReference returnType ) : void

Converts the return value of a method into the target type. If the target type is void, then the value will simply be popped from the stack.

PushArguments ( this IL, IMethodSignature method, Mono.Cecil.ModuleDefinition module, Mono.Cecil.Cil.VariableDefinition arguments ) : void

Pushes the arguments of a method onto the stack.

PushField ( this IL, FieldReference field, Mono.Cecil.ModuleDefinition module ) : void

Pushes the current field onto the stack.

PushGenericArguments ( this IL, IGenericParameterProvider method, Mono.Cecil.ModuleDefinition module, Mono.Cecil.Cil.VariableDefinition typeArguments ) : void

Saves the generic type arguments that were used to construct the method.

PushMethod ( this IL, MethodReference method, Mono.Cecil.ModuleDefinition module ) : void

Pushes the current method onto the stack.

PushStackTrace ( this IL, Mono.Cecil.ModuleDefinition module ) : void

Pushes the stack trace of the currently executing method onto the stack.

PushType ( this IL, TypeReference type, Mono.Cecil.ModuleDefinition module ) : void

Pushes a Type instance onto the stack.

SaveParameterTypes ( this IL, MethodReference method, Mono.Cecil.ModuleDefinition module, Mono.Cecil.Cil.VariableDefinition parameterTypes ) : void

Saves the current method signature of a method into an array of System.Type objects. This can be used to determine the signature of methods with generic type parameters or methods that have parameters that are generic parameters specified by the type itself.

Stind ( this IL, TypeReference currentType ) : void

Emits the proper Stind (store indirect) IL instruction for the currentType.

비공개 메소드들

메소드 설명
CilWorkerExtensions ( ) : System
GetDeclaringType ( TypeReference declaringType ) : TypeReference

Obtains the declaring type for a given type reference.

PushParameter ( this IL, int index, Mono.Cecil.Cil.VariableDefinition arguments, Mono.Cecil.ParameterDefinition param ) : void

Stores the current parameter value into the array of method arguments.

메소드 상세

EmitWriteLine() 공개 정적인 메소드

Emits a Console.WriteLine call using the current CilWorker.
public static EmitWriteLine ( this IL, string text ) : void
IL this The target CilWorker.
text string The text that will be written to the console.
리턴 void

EmitWriteLineIfNull() 공개 정적인 메소드

Emits a Console.WriteLine call to using the current CilWorker that will only be called if the contents of the target variable are null at runtime.
public static EmitWriteLineIfNull ( this IL, string text, Mono.Cecil.Cil.VariableDefinition targetVariable ) : void
IL this The target CilWorker.
text string The text that will be written to the console.
targetVariable Mono.Cecil.Cil.VariableDefinition The target variable that will be checked for null at runtime.
리턴 void

GetDeclaringType() 공개 정적인 메소드

Gets the declaring type for the target method.
public static GetDeclaringType ( this method ) : TypeReference
method this The target method.
리턴 Mono.Cecil.TypeReference

GetMethod() 공개 정적인 메소드

Obtains the method definition that contains the current CilWorker.
public static GetMethod ( this IL ) : Mono.Cecil.MethodDefinition
IL this The responsible for the method body.
리턴 Mono.Cecil.MethodDefinition

GetModule() 공개 정적인 메소드

Obtains the module that contains the current CilWorker.
public static GetModule ( this IL ) : Mono.Cecil.ModuleDefinition
IL this The responsible for the method body.
리턴 Mono.Cecil.ModuleDefinition

PackageReturnValue() 공개 정적인 메소드

Converts the return value of a method into the target type. If the target type is void, then the value will simply be popped from the stack.
public static PackageReturnValue ( this IL, Mono.Cecil.ModuleDefinition module, TypeReference returnType ) : void
IL this The that will be used to create the instructions.
module Mono.Cecil.ModuleDefinition The module that contains the host method.
returnType Mono.Cecil.TypeReference The method return type itself.
리턴 void

PushArguments() 공개 정적인 메소드

Pushes the arguments of a method onto the stack.
public static PushArguments ( this IL, IMethodSignature method, Mono.Cecil.ModuleDefinition module, Mono.Cecil.Cil.VariableDefinition arguments ) : void
IL this The that will be used to create the instructions.
method IMethodSignature The target method.
module Mono.Cecil.ModuleDefinition The module that contains the host method.
arguments Mono.Cecil.Cil.VariableDefinition The local variable that will hold the array of arguments.
리턴 void

PushField() 공개 정적인 메소드

Pushes the current field onto the stack.
public static PushField ( this IL, FieldReference field, Mono.Cecil.ModuleDefinition module ) : void
IL this The that will be used to create the instructions.
field Mono.Cecil.FieldReference The field that represents the that will be pushed onto the stack.
module Mono.Cecil.ModuleDefinition The module that contains the target field.
리턴 void

PushGenericArguments() 공개 정적인 메소드

Saves the generic type arguments that were used to construct the method.
public static PushGenericArguments ( this IL, IGenericParameterProvider method, Mono.Cecil.ModuleDefinition module, Mono.Cecil.Cil.VariableDefinition typeArguments ) : void
IL this The that will be used to create the instructions.
method IGenericParameterProvider The target method whose generic type arguments (if any) will be saved into the local variable.
module Mono.Cecil.ModuleDefinition The module that contains the host method.
typeArguments Mono.Cecil.Cil.VariableDefinition The local variable that will store the resulting array of objects.
리턴 void

PushMethod() 공개 정적인 메소드

Pushes the current method onto the stack.
public static PushMethod ( this IL, MethodReference method, Mono.Cecil.ModuleDefinition module ) : void
IL this The that will be used to create the instructions.
method Mono.Cecil.MethodReference The method that represents the that will be pushed onto the stack.
module Mono.Cecil.ModuleDefinition The module that contains the host method.
리턴 void

PushStackTrace() 공개 정적인 메소드

Pushes the stack trace of the currently executing method onto the stack.
public static PushStackTrace ( this IL, Mono.Cecil.ModuleDefinition module ) : void
IL this The that will be used to create the instructions.
module Mono.Cecil.ModuleDefinition The module that contains the host method.
리턴 void

PushType() 공개 정적인 메소드

Pushes a Type instance onto the stack.
public static PushType ( this IL, TypeReference type, Mono.Cecil.ModuleDefinition module ) : void
IL this The that will be used to create the instructions.
type Mono.Cecil.TypeReference The type that represents the that will be pushed onto the stack.
module Mono.Cecil.ModuleDefinition The module that contains the host method.
리턴 void

SaveParameterTypes() 공개 정적인 메소드

Saves the current method signature of a method into an array of System.Type objects. This can be used to determine the signature of methods with generic type parameters or methods that have parameters that are generic parameters specified by the type itself.
public static SaveParameterTypes ( this IL, MethodReference method, Mono.Cecil.ModuleDefinition module, Mono.Cecil.Cil.VariableDefinition parameterTypes ) : void
IL this The that will be used to create the instructions.
method Mono.Cecil.MethodReference The target method whose generic type arguments (if any) will be saved into the local variable .
module Mono.Cecil.ModuleDefinition The module that contains the host method.
parameterTypes Mono.Cecil.Cil.VariableDefinition The local variable that will store the current method signature.
리턴 void

Stind() 공개 정적인 메소드

Emits the proper Stind (store indirect) IL instruction for the currentType.
public static Stind ( this IL, TypeReference currentType ) : void
IL this The target that will emit the IL.
currentType Mono.Cecil.TypeReference The type of data being stored.
리턴 void