/// <summary> /// Visits the specified greater than. /// </summary> /// <param name="greaterThan">The greater than.</param> public override void Visit(IGreaterThan greaterThan) { GreaterThan mutableGreaterThan = new GreaterThan(greaterThan); this.resultExpression = this.myCodeCopier.DeepCopy(mutableGreaterThan); }
/// <summary> /// Visits the specified greater than. /// </summary> /// <param name="greaterThan">The greater than.</param> /// <returns></returns> protected virtual IExpression DeepCopy(GreaterThan greaterThan) { return this.DeepCopy((BinaryOperation)greaterThan); }
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; }
public override IExpression Visit(GreaterThan greaterThan) { var castIfPossible = greaterThan.LeftOperand as ICastIfPossible; if (castIfPossible != null) { var compileTimeConstant = greaterThan.RightOperand as ICompileTimeConstant; if (compileTimeConstant != null && compileTimeConstant.Value == null) { return this.Visit(new CheckIfInstance() { Operand = castIfPossible.ValueToCast, TypeToCheck = castIfPossible.TargetType, Type = greaterThan.Type, Locations = greaterThan.Locations }); } } castIfPossible = greaterThan.RightOperand as ICastIfPossible; if (castIfPossible != null) { var compileTimeConstant = greaterThan.LeftOperand as ICompileTimeConstant; if (compileTimeConstant != null && compileTimeConstant.Value == null) { return this.Visit(new CheckIfInstance() { Operand = castIfPossible.ValueToCast, TypeToCheck = castIfPossible.TargetType, Type = greaterThan.Type, Locations = greaterThan.Locations }); } } return base.Visit(greaterThan); }
/// <summary> /// Visits the specified greater than. /// </summary> /// <param name="greaterThan">The greater than.</param> /// <returns></returns> public virtual IExpression Visit(GreaterThan greaterThan) { return this.Visit((BinaryOperation)greaterThan); }
/// <summary> /// Rewrites the children of the given greater-than expression. /// </summary> public virtual void RewriteChildren(GreaterThan greaterThan) { this.RewriteChildren((BinaryOperation)greaterThan); }
/// <summary> /// Visits the specified greater than. /// </summary> /// <param name="greaterThan">The greater than.</param> public override void Visit(IGreaterThan greaterThan) { GreaterThan mutableGreaterThan = greaterThan as GreaterThan; if (alwaysMakeACopy || mutableGreaterThan == null) mutableGreaterThan = new GreaterThan(greaterThan); this.resultExpression = this.myCodeMutator.Visit(mutableGreaterThan); }