Exemplo n.º 1
0
        protected override void BuildActSourceCode(MethodSourceCodeGenerationRequest request)
        {
            var method         = request.Method;
            var arguments      = expressionBuilder.CreateArgumentExpressions(method.GetParameters(), request.NullArgumentNeedsExplicitCast, request.ParameterDestinedAsNull);
            var callExpression = method.IsStatic ? Expression.Call(method, arguments) : Expression.Call(InstanceExpression, method, arguments);

            Append(expressionBuilder.ExpressionToString(callExpression));
            AppendLine(";");
        }
Exemplo n.º 2
0
        protected override void BuildActSourceCode(ConstructorSourceCodeGenerationRequest request)
        {
            var createInstanceExpr = CreateCtorExpression(request.Constructor, request.ParameterDestinedAsNull, request.NullArgumentNeedsExplicitCast);

            Append(expressionBuilder.ExpressionToString(createInstanceExpr));
            AppendLine(";");
        }
Exemplo n.º 3
0
        protected override void BuildActSourceCode(ConstructorSourceCodeGenerationRequest request)
        {
            var createInstanceExpr = CreateCtorExpression(request.Constructor, request.ParameterDestinedAsNull, request.NullArgumentNeedsExplicitCast);

            var varExpr    = Expression.Variable(request.Constructor.DeclaringType, "instance");
            var assignExpr = Expression.Assign(varExpr, createInstanceExpr);

            Append("var ");
            Append(expressionBuilder.ExpressionToString(assignExpr).RemoveParantheses());
            AppendLine(";");
        }