Exemplo n.º 1
0
        public Type CreateDelegate(GeneratedVariable variable, Func <MethodBuilderBundle> info, Type returnType)
        {
            this.actions.Add(new LoadVariableFunctionAction(() => this, variable.LocalIndex, info));
            var action = new CreateDelegateAction(returnType);

            this.actions.Add(action);
            return(action.DelegateType);
        }
Exemplo n.º 2
0
        public Type CreateDelegate(GeneratedVariable variable, MethodInfo info)
        {
            this.actions.Add(new LoadVariableFunctionAction(() => this, variable.LocalIndex, info));
            var action = new CreateDelegateAction(info.ReturnType);

            this.actions.Add(action);
            return(action.DelegateType);
        }
Exemplo n.º 3
0
        public MethodInfo Target <TTarget>(GeneratedVariable variable, Expression <Action <TTarget> > expression)
        {
            var methodCall = (MethodCallExpression)expression.Body;

            var parameters = new List <IGeneratedParameter>();

            int counter = 1;

            generator.Returns(methodCall.Method.ReturnType);
            foreach (ParameterInfo parameter in methodCall.Method.GetParameters())
            {
                generator.WithArgument(parameter.ParameterType);
                parameters.Add(new ExpressionParameter(parameter.ParameterType, counter));

                counter++;
            }

            Target(variable, parameters, methodCall.Method.Name, () => methodCall.Method);

            return(methodCall.Method);
        }
Exemplo n.º 4
0
 public void Target(GeneratedVariable variable, MethodInfo method)
 {
     actions.Add(new LoadVariableFunctionAction(() => this, variable.LocalIndex, method));
 }
Exemplo n.º 5
0
 public void Target(GeneratedVariable variable)
 {
     this.TypeGenerationContext.TypeGenerationActions.Add(new VariableLoadAction(GeneratedMethod, variable.LocalIndex));
 }
Exemplo n.º 6
0
 public void Target(GeneratedVariable variable, List <IGeneratedParameter> parameters, string methodName, Func <MethodInfo> info)
 {
     generator.AddMethod(methodName, context.WrapMethod(info, parameters));
 }
Exemplo n.º 7
0
 public void SetValueAtIndex(GeneratedVariable variable, int index)
 {
     actions.Add(new SetValueAtIndexAction(method, this, variable, index));
 }