예제 #1
0
        public CodegenExpression CodegenLong(
            CodegenExpression inner,
            CodegenMethodScope codegenMethodScope,
            ExprForgeCodegenSymbol exprSymbol,
            CodegenClassScope classScope)
        {
            var formatField = CodegenFormatFieldInit(classScope);
            var blockMethod = codegenMethodScope.MakeChild(typeof(string), typeof(ReformatFormatForge), classScope)
                .AddParam(typeof(long), "ts")
                .Block;
            var syncBlock = blockMethod.LockOn(formatField);
            if (_timeAbacus.OneSecond == 1000L) {
                syncBlock.BlockReturn(ExprDotMethod(formatField, "Format", Ref("ts")));
            }
            else {
                syncBlock.BlockReturn(ExprDotMethod(formatField, "Format", _timeAbacus.ToDateCodegen(Ref("ts"))));
            }

            return LocalMethodBuild(blockMethod.MethodEnd()).Pass(inner).Call();
        }