public static ICoder <IEnumerable <T> > GenSwitch <T>(ICoder <object> switchCoder, ICoder <T> labelCoder, ICoder <T> statementCoder, ICoder <object> defaultCoder) where T : class { var sing = labelCoder.WithPrefix("\tcase ").WithPostfix(":").Combine(statementCoder, Id).WithPostfix("break;"); var body = sing.Many("\n").WithPostfix("\n\tdefault:").Combine(defaultCoder, m => new object()).Between("\n").Brace(); return(body.CombineReverse(switchCoder.Bracket().WithPrefix("switch").WithPostfix("\n"), m => new object())); }
public static ICoder <T> GenFunction <T, T1>(ICoder <T1> signatureCoder, ICoder <T> bodyCoder, Func <T, T1> selector) where T : class where T1 : class { var body = bodyCoder.WithPrefix("\n").WithPostfix("\n").Brace().WithPostfix("\n"); return(GenCombineReverse(signatureCoder.WithPostfix("\n"), body, selector)); }
public static ICoder <T> WithStatic <T>(this ICoder <T> coder) where T : class { return(coder.WithPrefix("static ")); }
public static ICoder <T> WithPrivate <T>(this ICoder <T> coder) where T : class { return(coder.WithPrefix("private ")); }