public ArrayEmitter <object> EmitArguments(IReadOnlyList <ParameterInfo> parameters, ParametersEmitter parametersEmitter) { // object[] args = new object[paramCount]; _ilGenerator.Emit(OpCodes.Nop); _internalEmitter.EmitBeginSet((int)PackedArgumentPosition.MethodArguments); var argsEmitter = new ArrayEmitter <object>(_ilGenerator, parameters.Count); for (var i = 0; i < parameters.Count; i++) { if (parameters[i].IsOut) { continue; } // args[i] = argi; argsEmitter.EmitBeginSet(i); parametersEmitter.EmitGet(i); argsEmitter.EmitEndSet(parameters[i].ParameterType); } argsEmitter.EmitLoad(); _internalEmitter.EmitEndSet(typeof(object[])); return(argsEmitter); }
public void EmitGenericArguments(IReadOnlyList <Type> genericArgs) { _internalEmitter.EmitBeginSet((int)PackedArgumentPosition.GenericParameters); var typesEmitter = new ArrayEmitter <Type>(_ilGenerator, genericArgs.Count); for (var i = 0; i < genericArgs.Count; ++i) { typesEmitter.EmitBeginSet(i); _ilGenerator.Emit(OpCodes.Ldtoken, genericArgs[i]); _ilGenerator.Emit(OpCodes.Call, MethodReferences.GetTypeFromHandle); typesEmitter.EmitEndSet(typeof(Type)); } typesEmitter.EmitLoad(); _internalEmitter.EmitEndSet(typeof(Type[])); }
public void EmitLoad() { _internalEmitter.EmitLoad(); }