C# 클래스 CK.Reflection.ILGeneratorExtension

Provides extension methods on ILGenerator class.
파일 보기 프로젝트 열기: Invenietis/ck-core

공개 메소드들

메소드 설명
CreateObjectArrayFromInstanceParameters ( this g, LocalBuilder array, Type parameters ) : void

Emits the IL to create a new array (OpCodes.Newarr) of objects and fills it with the actual arguments of the method (parameters are boxed if needed) skipping the very first one: this must be used only inside a method with System.Reflection.CallingConventions.HasThis set.

LdArg ( this g, int i ) : void

Emits the IL to push (OpCodes.Ldarg) the actual argument at the given index onto the stack.

LdArgBox ( this g, ParameterInfo p ) : void

Emits a LdArg with an optional OpCodes.Box if p's type is a value type or a generic parameter (after a OpCodes.Ldobj if the parameter is by ref). Handles static or instance methods (takes care of System.Reflection.CallingConventions.HasThis bit of the method's CallingConvention).

LdArgBox ( this g, int idxParameter, Type parameterType ) : void

Emits a LdArg with a OpCodes.Box if parameterType is a value type or a generic parameter (after a OpCodes.Ldobj if the parameter is by ref).

LdInt32 ( this g, int i ) : void

Emits the IL to push the integer (emits the best opcode depending on the value: OpCodes.Ldc_I4_0 or OpCodes.Ldc_I4_M1 for instance) value onto the stack.

LdLoc ( this g, LocalBuilder local ) : void

Emits the IL to push (OpCodes.Ldloc) the given local on top of the stack.

RepushActualParameters ( this g, bool startAtArgument0, int count ) : void

Emits the optimal IL to push the actual parameter values on the stack (OpCodes.Ldarg_0... OpCodes.Ldarg).

StArg ( this g, int i ) : void

Emits the IL to pop (OpCodes.Starg) the top of the stack into the actual argument at the given index.

StLoc ( this g, LocalBuilder local ) : void

Emits the IL to pop (OpCodes.Stloc) the top of the stack into a local variable.

StoreDefaultValueForOutParameter ( this g, ParameterInfo byRefParameter ) : void

Emits code that sets the parameter (that must be a 'ref' or 'out' parameter) to the default of its type. Handles static or instance methods and value or reference type.

메소드 상세

CreateObjectArrayFromInstanceParameters() 공개 정적인 메소드

Emits the IL to create a new array (OpCodes.Newarr) of objects and fills it with the actual arguments of the method (parameters are boxed if needed) skipping the very first one: this must be used only inside a method with System.Reflection.CallingConventions.HasThis set.
public static CreateObjectArrayFromInstanceParameters ( this g, LocalBuilder array, Type parameters ) : void
g this This object.
array System.Reflection.Emit.LocalBuilder The local variable.
parameters System.Type Type of the method parameters.
리턴 void

LdArg() 공개 정적인 메소드

Emits the IL to push (OpCodes.Ldarg) the actual argument at the given index onto the stack.
public static LdArg ( this g, int i ) : void
g this This object.
i int Parameter index (0 being the 'this' for instance method).
리턴 void

LdArgBox() 공개 정적인 메소드

Emits a LdArg with an optional OpCodes.Box if p's type is a value type or a generic parameter (after a OpCodes.Ldobj if the parameter is by ref). Handles static or instance methods (takes care of System.Reflection.CallingConventions.HasThis bit of the method's CallingConvention).
public static LdArgBox ( this g, ParameterInfo p ) : void
g this This object.
p System.Reflection.ParameterInfo Parameter of the current method.
리턴 void

LdArgBox() 공개 정적인 메소드

Emits a LdArg with a OpCodes.Box if parameterType is a value type or a generic parameter (after a OpCodes.Ldobj if the parameter is by ref).
public static LdArgBox ( this g, int idxParameter, Type parameterType ) : void
g this This object.
idxParameter int Index of the parameter to load on the stack.
parameterType System.Type Type of the parameter.
리턴 void

LdInt32() 공개 정적인 메소드

Emits the IL to push the integer (emits the best opcode depending on the value: OpCodes.Ldc_I4_0 or OpCodes.Ldc_I4_M1 for instance) value onto the stack.
public static LdInt32 ( this g, int i ) : void
g this This object.
i int The integer value to push.
리턴 void

LdLoc() 공개 정적인 메소드

Emits the IL to push (OpCodes.Ldloc) the given local on top of the stack.
public static LdLoc ( this g, LocalBuilder local ) : void
g this This object.
local System.Reflection.Emit.LocalBuilder The local variable to push.
리턴 void

RepushActualParameters() 공개 정적인 메소드

Emits the optimal IL to push the actual parameter values on the stack (OpCodes.Ldarg_0... OpCodes.Ldarg).
public static RepushActualParameters ( this g, bool startAtArgument0, int count ) : void
g this This object.
startAtArgument0 bool False to skip the very first argument: for a method instance Arg0 is the 'this' object (see ) HasThis and ExplicitThis).
count int Number of parameters to push.
리턴 void

StArg() 공개 정적인 메소드

Emits the IL to pop (OpCodes.Starg) the top of the stack into the actual argument at the given index.
public static StArg ( this g, int i ) : void
g this This object.
i int Parameter index (0 being the 'this' for instance method).
리턴 void

StLoc() 공개 정적인 메소드

Emits the IL to pop (OpCodes.Stloc) the top of the stack into a local variable.
public static StLoc ( this g, LocalBuilder local ) : void
g this This object.
local System.Reflection.Emit.LocalBuilder The local variable to pop.
리턴 void

StoreDefaultValueForOutParameter() 공개 정적인 메소드

Emits code that sets the parameter (that must be a 'ref' or 'out' parameter) to the default of its type. Handles static or instance methods and value or reference type.
public static StoreDefaultValueForOutParameter ( this g, ParameterInfo byRefParameter ) : void
g this This object.
byRefParameter System.Reflection.ParameterInfo The 'by ref' parameter.
리턴 void