Esempio n. 1
0
        public static IfCodeBody <TThis> IfEmittedBase <TParent, TThis>(FluentCodeBody <TParent, TThis> body,
                                                                        Expression condition)
            where TThis : FluentCodeBody <TParent, TThis>
        {
            CodeExpression cond = new CodeExpressionVisitor(new VisitorContext()).Visit(condition);

            return(body.If(cond));
        }
Esempio n. 2
0
        public static TThis StmtEmittedBase <TParent, TThis>(FluentCodeBody <TParent, TThis> body,
                                                             Expression condition)
            where TThis : FluentCodeBody <TParent, TThis>
        {
            CodeExpression expr = new CodeExpressionVisitor(new VisitorContext()).Visit(condition);

            body.Stmt(expr);

            return(FluentCodeBody <TParent, TThis> .ThisConverter(body));
        }
Esempio n. 3
0
 public static TParent GetParent(FluentCodeBody <TParent, TThis> fluentBody)
 {
     return(fluentBody._parent);
 }
Esempio n. 4
0
        /////////////////////////////////////////////////////////////////
        //                           Static                            //
        /////////////////////////////////////////////////////////////////

        public static ICodeBodyProvider GetBodyProvider(FluentCodeBody <TParent, TThis> fluentBody)
        {
            return(fluentBody._bodyProvider);
        }
Esempio n. 5
0
 /// <summary>
 /// This method is a little bit of a hack, because normaly you coudn't convert
 /// FluetnCodeDom Of TParent, TThis into TThis, this function converts it first
 /// into object and then back into TThis
 /// </summary>
 /// <param name="thisInstance"></param>
 /// <returns></returns>
 public static TThis ThisConverter(FluentCodeBody <TParent, TThis> thisInstance)
 {
     return((TThis)(object)thisInstance);
 }
Esempio n. 6
0
 protected virtual TThis AddStatement(CodeExpression expression)
 {
     _bodyProvider.Statements.Add(expression);
     return(FluentCodeBody <TParent, TThis> .ThisConverter(this));
 }
Esempio n. 7
0
        /////////////////////////////////////////////////////////////////
        //                          Return                             //
        /////////////////////////////////////////////////////////////////

        public static TThis Return <TParent, TThis, T>(this FluentCodeBody <TParent, TThis> body,
                                                       Expression <Func <T> > expr)
            where TThis : FluentCodeBody <TParent, TThis>
        {
            return(ReturnEmittedBase <TParent, TThis>(body, expr));
        }
Esempio n. 8
0
 public static TThis Stmt <TParent, TThis, T, T2, T3>(this FluentCodeBody <TParent, TThis> body,
                                                      Expression <Action <T, T2, T3> > statement)
     where TThis : FluentCodeBody <TParent, TThis>
 {
     return(StmtEmittedBase <TParent, TThis>(body, statement));
 }
Esempio n. 9
0
 public static IfCodeBody <TThis> If <TParent, TThis, T, T2>(this FluentCodeBody <TParent, TThis> body,
                                                             Expression <Func <T, T2, bool> > condition)
     where TThis : FluentCodeBody <TParent, TThis>
 {
     return(IfEmittedBase <TParent, TThis>(body, condition));
 }
Esempio n. 10
0
        /////////////////////////////////////////////////////////////////
        //                            If                               //
        /////////////////////////////////////////////////////////////////

        public static IfCodeBody <TThis> If <TParent, TThis>(FluentCodeBody <TParent, TThis> body,
                                                             Expression condition)
            where TThis : FluentCodeBody <TParent, TThis>
        {
            return(IfEmittedBase <TParent, TThis>(body, condition));
        }