示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#4
0
 public void Target(GeneratedVariable variable, MethodInfo method)
 {
     actions.Add(new LoadVariableFunctionAction(() => this, variable.LocalIndex, method));
 }
示例#5
0
 public void Target(GeneratedVariable variable)
 {
     this.TypeGenerationContext.TypeGenerationActions.Add(new VariableLoadAction(GeneratedMethod, variable.LocalIndex));
 }
示例#6
0
 public void Target(GeneratedVariable variable, List <IGeneratedParameter> parameters, string methodName, Func <MethodInfo> info)
 {
     generator.AddMethod(methodName, context.WrapMethod(info, parameters));
 }
示例#7
0
 public void SetValueAtIndex(GeneratedVariable variable, int index)
 {
     actions.Add(new SetValueAtIndexAction(method, this, variable, index));
 }