示例#1
0
        public WrapMethodAction(BaseTypeGenerationContext context, Func <MethodInfo> methodInfo, List <IGeneratedParameter> parameters, int index)
        {
            var generatedMethod = context.AddMethod(method =>
            {
                method.Named(() => methodInfo().Name + "_" + index);
                method.AddArguments(() => parameters);
                method.Returns(() => methodInfo().ReturnType);

                method.WithBody(body =>
                {
                    body.TargettingSelf();
                    if (method.ReturnType() != typeof(void))
                    {
                        var variable = body.CreateVariable(method.ReturnType());

                        variable.AssignFrom(() => body.Call(methodInfo, () => parameters));
                        body.Return(variable);
                    }
                    else
                    {
                        body.Call(methodInfo, () => parameters);
                    }
                });
            });

            GeneratedMethod = generatedMethod;
        }
示例#2
0
        public WrapMethodAction(BaseTypeGenerationContext context, Func<MethodInfo> methodInfo, List<IGeneratedParameter> parameters, int index)
        {
            var generatedMethod = context.AddMethod(method =>
            {
                method.Named(() => methodInfo().Name + "_" + index);
                method.AddArguments(() => parameters);
                method.Returns(() => methodInfo().ReturnType);

                method.WithBody(body =>
                {
                    body.TargettingSelf();
                    if (method.ReturnType() != typeof(void))
                    {
                        var variable = body.CreateVariable(method.ReturnType());

                        variable.AssignFrom(() => body.Call(methodInfo, () => parameters));
                        body.Return(variable);
                    }
                    else
                    {
                        body.Call(methodInfo, () => parameters);
                    }
                });
            });

            GeneratedMethod = generatedMethod;
        }
示例#3
0
        public WrapMethodAction(BaseTypeGenerationContext context, Func <MethodBuilderBundle> methodBuilder, List <IGeneratedParameter> parameters, int index)
        {
            var generatedMethod = context.AddMethod(method =>
            {
                method.Named(() => methodBuilder().MethodBuilder.Name + "_" + index);
                method.AddArguments(() => parameters);
                method.Returns(() => methodBuilder().MethodBuilder.ReturnType);

                method.WithBody(body =>
                {
                    body.TargettingSelf();
                    body.Return(body.Call(() => methodBuilder().MethodBuilder, () => parameters));
                });
            });

            GeneratedMethod = generatedMethod;
        }
示例#4
0
        public WrapMethodAction(BaseTypeGenerationContext context, Func<MethodBuilderBundle> methodBuilder, List<IGeneratedParameter> parameters, int index)
        {
            var generatedMethod = context.AddMethod(method =>
            {
                method.Named(() => methodBuilder().MethodBuilder.Name + "_" + index);
                method.AddArguments(() => parameters);
                method.Returns(() => methodBuilder().MethodBuilder.ReturnType);

                method.WithBody(body =>
                {
                    body.TargettingSelf();
                    body.Return(body.Call(() => methodBuilder().MethodBuilder, () => parameters));
                });
            });

            GeneratedMethod = generatedMethod;
        }