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)); }
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)); }
public static TParent GetParent(FluentCodeBody <TParent, TThis> fluentBody) { return(fluentBody._parent); }
///////////////////////////////////////////////////////////////// // Static // ///////////////////////////////////////////////////////////////// public static ICodeBodyProvider GetBodyProvider(FluentCodeBody <TParent, TThis> fluentBody) { return(fluentBody._bodyProvider); }
/// <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); }
protected virtual TThis AddStatement(CodeExpression expression) { _bodyProvider.Statements.Add(expression); return(FluentCodeBody <TParent, TThis> .ThisConverter(this)); }
///////////////////////////////////////////////////////////////// // 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)); }
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)); }
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)); }
///////////////////////////////////////////////////////////////// // 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)); }