public ReformatBetweenNonConstantParamsForge(IList<ExprNode> parameters) { _start = parameters[0]; _startCoercer = DatetimeLongCoercerFactory.GetCoercer(_start.Forge.EvaluationType); _end = parameters[1]; _secondCoercer = DatetimeLongCoercerFactory.GetCoercer(_end.Forge.EvaluationType); if (parameters.Count == 2) { _includeBoth = true; _includeLow = true; _includeHigh = true; } else { if (parameters[2].Forge.ForgeConstantType.IsCompileTimeConstant) { _includeLow = GetBooleanValue(parameters[2]); } else { _forgeIncludeLow = parameters[2].Forge; } if (parameters[3].Forge.ForgeConstantType.IsCompileTimeConstant) { _includeHigh = GetBooleanValue(parameters[3]); } else { _forgeIncludeHigh = parameters[3].Forge; } if (_includeLow.GetValueOrDefault(false) && _includeHigh.GetValueOrDefault(false)) { _includeBoth = true; } } }
private static void CodegenLongCoercion( CodegenBlock block, string variable, ExprNode assignment, DatetimeLongCoercer coercer, CodegenMethodScope codegenMethodScope, ExprForgeCodegenSymbol exprSymbol, CodegenClassScope codegenClassScope) { var evaluationType = assignment.Forge.EvaluationType; if (evaluationType == typeof(long)) { block.DeclareVar<long>( variable, assignment.Forge.EvaluateCodegen(typeof(long), codegenMethodScope, exprSymbol, codegenClassScope)); return; } var refname = variable + "Obj"; block.DeclareVar( evaluationType, refname, assignment.Forge.EvaluateCodegen(evaluationType, codegenMethodScope, exprSymbol, codegenClassScope)); if (evaluationType.CanBeNull()) { block.IfRefNullReturnNull(refname); } block.DeclareVar<long>(variable, coercer.Codegen(Ref(refname), evaluationType, codegenClassScope)); //block.Debug("CodegenLongCoercion: {0} => {1}", Ref(refname), Ref(variable)); }
public ReformatOpBetweenNonConstantParams(IList <ExprNode> parameters, TimeZoneInfo timeZone) { _timeZone = timeZone; _start = parameters[0]; _startEval = _start.ExprEvaluator; _startCoercer = DatetimeLongCoercerFactory.GetCoercer(_startEval.ReturnType, timeZone); _end = parameters[1]; _endEval = _end.ExprEvaluator; _secondCoercer = DatetimeLongCoercerFactory.GetCoercer(_endEval.ReturnType, timeZone); if (parameters.Count == 2) { _includeBoth = true; _includeLow = true; _includeHigh = true; } else { if (parameters[2].IsConstantResult) { _includeLow = GetBooleanValue(parameters[2]); } else { _evalIncludeLow = parameters[2].ExprEvaluator; } if (parameters[3].IsConstantResult) { _includeHigh = GetBooleanValue(parameters[3]); } else { _evalIncludeHigh = parameters[3].ExprEvaluator; } if (_includeLow != null && _includeHigh != null && _includeLow.Value && _includeHigh.Value) { _includeBoth = true; } } }