Beispiel #1
0
        public override CodegenExpression Codegen(
            EnumForgeCodegenParams args,
            CodegenMethodScope codegenMethodScope,
            CodegenClassScope codegenClassScope)
        {
            var type   = _resultType.GetCodegenReturnType();
            var method = codegenMethodScope
                         .MakeChild(type, typeof(EnumFirstOf), codegenClassScope)
                         .AddParam(EnumForgeCodegenNames.PARAMS)
                         .Block
                         .IfCondition(Or(EqualsNull(EnumForgeCodegenNames.REF_ENUMCOLL), ExprDotMethod(EnumForgeCodegenNames.REF_ENUMCOLL, "IsEmpty")))
                         .BlockReturn(ConstantNull())
                         .MethodReturn(FlexCast(type, ExprDotMethodChain(EnumForgeCodegenNames.REF_ENUMCOLL).Add("First")));

            return(LocalMethod(method, args.Expressions));
        }
Beispiel #2
0
        public override CodegenExpression Codegen(
            EnumForgeCodegenParams args,
            CodegenMethodScope codegenMethodScope,
            CodegenClassScope codegenClassScope)
        {
            var type   = _resultType.GetCodegenReturnType().GetBoxedType();
            var method = codegenMethodScope.MakeChild(type, typeof(EnumLastOf), codegenClassScope)
                         .AddParam(EnumForgeCodegenNames.PARAMS)
                         .Block
                         .DeclareVar <object>("result", ConstantNull())
                         .ForEach(typeof(object), "next", EnumForgeCodegenNames.REF_ENUMCOLL)
                         .AssignRef("result", Ref("next"))
                         .BlockEnd()
                         .MethodReturn(FlexCast(type, Ref("result")));

            return(LocalMethod(method, args.Expressions));
        }
Beispiel #3
0
 public override Type ReturnType()
 {
     return(_columnType.GetCodegenReturnType().GetBoxedType());
 }
Beispiel #4
0
 public override Type ReturnType()
 {
     return(_resultType.GetCodegenReturnType().GetBoxedType());
 }