public override IExpression Rewrite(IConditional conditional) { if (conditional.Type.TypeCode == PrimitiveTypeCode.Boolean && ExpressionHelper.IsIntegralZero(conditional.ResultIfTrue)) { var not = new LogicalNot() { Operand = conditional.Condition, }; var c = new Conditional() { Condition = BooleanExpressionHelper.Normalize(not), ResultIfTrue = conditional.ResultIfFalse, ResultIfFalse = new CompileTimeConstant() { Type = conditional.Type, Value = false, }, Type = conditional.Type, }; return(c); } return(base.Rewrite(conditional)); }
public override IExpression Rewrite(ILogicalNot logicalNot) { var result = base.Rewrite(logicalNot); return(BooleanExpressionHelper.Normalize(result)); }