コード例 #1
0
 public DTLocalBeanCalOpsEval(
     DTLocalBeanCalOpsForge forge,
     DTLocalEvaluator inner)
 {
     this.forge = forge;
     this.inner = inner;
 }
コード例 #2
0
        public static CodegenExpression Codegen(
            DTLocalBeanCalOpsForge forge,
            CodegenExpression inner,
            Type innerType,
            CodegenMethodScope codegenMethodScope,
            ExprForgeCodegenSymbol exprSymbol,
            CodegenClassScope codegenClassScope)
        {
            var methodNode = codegenMethodScope
                .MakeChild(forge.innerReturnType, typeof(DTLocalBeanCalOpsEval), codegenClassScope)
                .AddParam(typeof(EventBean), "target");

            CodegenExpression timestamp = Ref("timestamp");
            
            methodNode.Block.DeclareVar(
                forge.getterReturnType,
                "timestamp",
                CodegenLegoCast.CastSafeFromObjectType(
                    forge.getterReturnType,
                    forge.getter.EventBeanGetCodegen(Ref("target"), methodNode, codegenClassScope)));
            if (forge.getterReturnType.CanBeNull()) {
                methodNode.Block.IfRefNullReturnNull("timestamp");
                if (forge.getterReturnType.IsNullable()) {
                    timestamp = Unbox(timestamp);
                }
            }

            methodNode.Block.MethodReturn(
                forge.inner.Codegen(
                    timestamp,
                    forge.getterReturnType,
                    methodNode,
                    exprSymbol,
                    codegenClassScope));
            return LocalMethod(methodNode, inner);
        }