/// <summary> /// Visits the specified less than. /// </summary> /// <param name="lessThan">The less than.</param> /// <returns></returns> protected virtual IExpression DeepCopy(LessThan lessThan) { return this.DeepCopy((BinaryOperation)lessThan); }
/// <summary> /// Visits the specified less than. /// </summary> /// <param name="lessThan">The less than.</param> public override void Visit(ILessThan lessThan) { LessThan mutableLessThan = new LessThan(lessThan); this.resultExpression = this.myCodeCopier.DeepCopy(mutableLessThan); }
private static IExpression InvertBinaryOperation(IBinaryOperation binOp) { Contract.Requires(binOp != null); Contract.Ensures(Contract.Result<IExpression>() != null); BinaryOperation/*?*/ result = null; if (binOp is IEquality && binOp.LeftOperand.Type.TypeCode != PrimitiveTypeCode.Float32 && binOp.LeftOperand.Type.TypeCode != PrimitiveTypeCode.Float64) result = new NotEquality(); else if (binOp is INotEquality && binOp.LeftOperand.Type.TypeCode != PrimitiveTypeCode.Float32 && binOp.LeftOperand.Type.TypeCode != PrimitiveTypeCode.Float64) result = new Equality(); else if (binOp is ILessThan) result = new GreaterThanOrEqual() { IsUnsignedOrUnordered = KeepUnsignedButInvertUnordered(((ILessThan)binOp).IsUnsignedOrUnordered, binOp) }; else if (binOp is ILessThanOrEqual) result = new GreaterThan() { IsUnsignedOrUnordered = KeepUnsignedButInvertUnordered(((ILessThanOrEqual)binOp).IsUnsignedOrUnordered, binOp) }; else if (binOp is IGreaterThan) result = new LessThanOrEqual() { IsUnsignedOrUnordered = KeepUnsignedButInvertUnordered(((IGreaterThan)binOp).IsUnsignedOrUnordered, binOp) }; else if (binOp is IGreaterThanOrEqual) result = new LessThan() { IsUnsignedOrUnordered = KeepUnsignedButInvertUnordered(((IGreaterThanOrEqual)binOp).IsUnsignedOrUnordered, binOp) }; if (result != null) { result.LeftOperand = binOp.LeftOperand; result.RightOperand = binOp.RightOperand; result.Type = binOp.Type; result.Locations.AddRange(binOp.Locations); return result; } LogicalNot logicalNot = new LogicalNot(); logicalNot.Operand = binOp; logicalNot.Type = binOp.Type; logicalNot.Locations.AddRange(binOp.Locations); return logicalNot; }
/// <summary> /// Visits the specified less than. /// </summary> /// <param name="lessThan">The less than.</param> /// <returns></returns> public virtual IExpression Visit(LessThan lessThan) { return this.Visit((BinaryOperation)lessThan); }
/// <summary> /// Rewrites the children of the given less-than expression. /// </summary> public virtual void RewriteChildren(LessThan lessThan) { this.RewriteChildren((BinaryOperation)lessThan); }
/// <summary> /// Visits the specified less than. /// </summary> /// <param name="lessThan">The less than.</param> public override void Visit(ILessThan lessThan) { LessThan mutableLessThan = lessThan as LessThan; if (alwaysMakeACopy || mutableLessThan == null) mutableLessThan = new LessThan(lessThan); this.resultExpression = this.myCodeMutator.Visit(mutableLessThan); }