protected override CodegenExpression CodegenEvaluateInternal( CodegenMethodScope parent, SubselectForgeNRSymbol symbols, CodegenClassScope classScope) { var method = parent.MakeChild(typeof(bool?), GetType(), classScope); var eps = symbols.GetAddEPS(method); var evalCtx = symbols.GetAddExprEvalCtx(method); var left = symbols.GetAddLeftResult(method); method.Block.IfNullReturnNull(symbols.GetAddLeftResult(method)); if (havingEval != null) { CodegenExpression having = LocalMethod( CodegenLegoMethodExpression.CodegenExpression(havingEval, method, classScope, true), eps, ConstantTrue(), evalCtx); CodegenLegoBooleanExpression.CodegenReturnValueIfNullOrNotPass( method.Block, havingEval.EvaluationType, having, ConstantNull()); } CodegenExpression select = LocalMethod( CodegenLegoMethodExpression.CodegenExpression(selectEval, method, classScope, true), eps, ConstantTrue(), evalCtx); var rightEvalType = selectEval.EvaluationType.GetBoxedType(); method.Block .DeclareVar(rightEvalType, "rhs", select) .IfRefNullReturnNull("rhs"); if (coercer == null) { method.Block.DeclareVar<bool>("eq", ExprDotMethod(left, "Equals", Ref("rhs"))); if (isNot) { method.Block.IfCondition(Ref("eq")).BlockReturn(ConstantFalse()); } else { method.Block.IfCondition(Not(Ref("eq"))).BlockReturn(ConstantFalse()); } } else { method.Block .DeclareVar<object>("left", coercer.CoerceCodegen(left, symbols.LeftResultType)) .DeclareVar<object>("right", coercer.CoerceCodegen(Ref("rhs"), rightEvalType)) .DeclareVar<bool>("eq", StaticMethod<object>("Equals", Ref("left"), Ref("right"))); if (isNot) { method.Block.IfCondition(Ref("eq")).BlockReturn(ConstantFalse()); } else { method.Block.IfCondition(Not(Ref("eq"))).BlockReturn(ConstantFalse()); } } method.Block.MethodReturn(ConstantTrue()); return LocalMethod(method); }
public CodegenExpression EvaluateMatchesCodegen( CodegenMethodScope parent, ExprSubselectEvalMatchSymbol symbols, CodegenClassScope classScope) { var method = parent.MakeChild(typeof(bool), GetType(), classScope); var havingMethod = CodegenLegoMethodExpression.CodegenExpression(havingEval, method, classScope, true); CodegenExpression having = LocalMethod( havingMethod, REF_EVENTS_SHIFTED, symbols.GetAddIsNewData(method), symbols.GetAddExprEvalCtx(method)); method.Block.ApplyTri(DECLARE_EVENTS_SHIFTED, method, symbols); CodegenLegoBooleanExpression.CodegenReturnValueIfNullOrNotPass( method.Block, typeof(bool?), having, ConstantFalse()); method.Block.MethodReturn(ConstantTrue()); return LocalMethod(method); }
protected override CodegenExpression CodegenEvaluateInternal( CodegenMethodScope parent, SubselectForgeNRSymbol symbols, CodegenClassScope classScope) { var method = parent.MakeChild(typeof(bool?), GetType(), classScope); CodegenExpression eps = symbols.GetAddEPS(method); CodegenExpression evalCtx = symbols.GetAddExprEvalCtx(method); var left = symbols.GetAddLeftResult(method); if (havingEval != null) { CodegenExpression having = LocalMethod( CodegenLegoMethodExpression.CodegenExpression(havingEval, method, classScope, true), eps, ConstantTrue(), evalCtx); CodegenLegoBooleanExpression.CodegenReturnValueIfNullOrNotPass( method.Block, havingEval.EvaluationType, having, ConstantNull()); } CodegenExpression rhsSide = LocalMethod( CodegenLegoMethodExpression.CodegenExpression(selectEval, method, classScope, true), eps, ConstantTrue(), evalCtx); var rhsType = selectEval.EvaluationType.GetBoxedType(); method.Block .DeclareVar(rhsType, "rhs", rhsSide) .IfRefNullReturnNull("rhs") .MethodReturn(computer.Codegen(left, symbols.LeftResultType, Ref("rhs"), rhsType)); return LocalMethod(method); }