public static CodegenExpression CodegenPointInTime( DTLocalDtxOpsIntervalForge forge, CodegenExpression inner, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { var methodNode = codegenMethodScope .MakeChild(typeof(bool?), typeof(DTLocalDtxOpsIntervalEval), codegenClassScope) .AddParam(typeof(DateTimeEx), "target"); var block = methodNode.Block .DeclareVar<DateTimeEx>("dtx", Cast(typeof(DateTimeEx), ExprDotMethod(Ref("target"), "Clone"))); EvaluateCalOpsDtxCodegen( block, forge.calendarForges, Ref("dtx"), methodNode, exprSymbol, codegenClassScope); block.DeclareVar<long>("time", ExprDotName(Ref("dtx"), "UtcMillis")) .MethodReturn( forge.intervalForge.Codegen(Ref("time"), Ref("time"), methodNode, exprSymbol, codegenClassScope)); return LocalMethod(methodNode, inner); }
public static CodegenExpression CodegenStartEnd( DTLocalDtxOpsIntervalForge forge, CodegenExpression start, CodegenExpression end, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { CodegenExpression timeZoneField = codegenClassScope.AddOrGetDefaultFieldSharable(RuntimeSettingsTimeZoneField.INSTANCE); var methodNode = codegenMethodScope .MakeChild(typeof(bool?), typeof(DTLocalDtxOpsIntervalEval), codegenClassScope) .AddParam(typeof(DateTimeEx), "startTimestamp") .AddParam(typeof(DateTimeEx), "endTimestamp"); var block = methodNode.Block .DeclareVar<long>("startLong", ExprDotName(Ref("startTimestamp"), "UtcMillis")) .DeclareVar<long>("endLong", ExprDotName(Ref("endTimestamp"), "UtcMillis")) .DeclareVar<DateTimeEx>("dtx", StaticMethod(typeof(DateTimeEx), "GetInstance", timeZoneField)) .Expression(ExprDotMethod(Ref("dtx"), "SetUtcMillis", Ref("startLong"))); EvaluateCalOpsDtxCodegen( block, forge.calendarForges, Ref("dtx"), methodNode, exprSymbol, codegenClassScope); block.DeclareVar<long>("startTime", ExprDotName(Ref("dtx"), "UtcMillis")) .DeclareVar<long>( "endTime", Op(Ref("startTime"), "+", Op(Ref("endLong"), "-", Ref("startLong")))) .MethodReturn( forge.intervalForge.Codegen( Ref("startTime"), Ref("endTime"), methodNode, exprSymbol, codegenClassScope)); return LocalMethod(methodNode, start, end); }