示例#1
0
        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()));
        }
示例#2
0
        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));
        }
示例#3
0
 public static ICoder <T> WithStatic <T>(this ICoder <T> coder) where T : class
 {
     return(coder.WithPrefix("static "));
 }
示例#4
0
 public static ICoder <T> WithPrivate <T>(this ICoder <T> coder) where T : class
 {
     return(coder.WithPrefix("private "));
 }