예제 #1
0
 public void EmitProxy()
 {
     // packed[PackedArgs.DispatchProxyPosition] = this;
     _internalEmitter.EmitBeginSet((int)PackedArgumentPosition.Proxy);
     _ilGenerator.Emit(OpCodes.Ldarg_0);
     _internalEmitter.EmitEndSet(typeof(IvoryProxy));
 }
예제 #2
0
            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);
            }
예제 #3
0
            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[]));
            }