示例#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));
        }
示例#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));
        }
示例#3
0
 public static TParent GetParent(FluentCodeBody <TParent, TThis> fluentBody)
 {
     return(fluentBody._parent);
 }
示例#4
0
        /////////////////////////////////////////////////////////////////
        //                           Static                            //
        /////////////////////////////////////////////////////////////////

        public static ICodeBodyProvider GetBodyProvider(FluentCodeBody <TParent, TThis> fluentBody)
        {
            return(fluentBody._bodyProvider);
        }
示例#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);
 }
示例#6
0
 protected virtual TThis AddStatement(CodeExpression expression)
 {
     _bodyProvider.Statements.Add(expression);
     return(FluentCodeBody <TParent, TThis> .ThisConverter(this));
 }
示例#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));
        }
示例#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));
 }
示例#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));
 }
示例#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));
        }