public override void Visit(INotEquality notEquality) { if (Process(notEquality)) { visitor.Visit(notEquality); } base.Visit(notEquality); }
private HLLocation ProcessNotEqualityExpression(INotEquality pExpression) { HLLocation locationLeftOperand = ProcessExpression(pExpression.LeftOperand); HLLocation locationRightOperand = ProcessExpression(pExpression.RightOperand); HLLocation locationTemporary = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type))); mCurrentBlock.EmitCompare(HLCompareType.NotEqual, locationTemporary, locationLeftOperand, locationRightOperand); return(pExpression.ResultIsUnmodifiedLeftOperand ? locationLeftOperand : locationTemporary); }
public override IExpression Rewrite(INotEquality notEquality) { base.Rewrite(notEquality); var cc1 = notEquality.LeftOperand as CompileTimeConstant; var cc2 = notEquality.RightOperand as CompileTimeConstant; if (cc1 != null && cc2 != null) { if (cc1.Type.TypeCode == PrimitiveTypeCode.Int32 && cc2.Type.TypeCode == PrimitiveTypeCode.Int32) { Contract.Assume(cc1.Value is int); Contract.Assume(cc2.Value is int); return(new CompileTimeConstant() { Value = ((int)cc1.Value) != ((int)cc2.Value), Type = notEquality.Type }); } } else if (cc2 != null && ExpressionHelper.IsNumericZero(cc2) && notEquality.LeftOperand.Type.TypeCode == PrimitiveTypeCode.Boolean) { return(notEquality.LeftOperand); } return(notEquality); }
public override IExpression Rewrite(INotEquality notEquality) { base.Rewrite(notEquality); var cc1 = notEquality.LeftOperand as CompileTimeConstant; var cc2 = notEquality.RightOperand as CompileTimeConstant; if (cc1 != null && cc2 != null) { if (cc1.Type.TypeCode == PrimitiveTypeCode.Int32 && cc2.Type.TypeCode == PrimitiveTypeCode.Int32) { Contract.Assume(cc1.Value is int); Contract.Assume(cc2.Value is int); return new CompileTimeConstant() { Value = ((int)cc1.Value) != ((int)cc2.Value), Type = notEquality.Type }; } } else if (cc2 != null && ExpressionHelper.IsNumericZero(cc2) && notEquality.LeftOperand.Type.TypeCode == PrimitiveTypeCode.Boolean) { return notEquality.LeftOperand; } return notEquality; }
public override IExpression Rewrite(INotEquality operation) { return(ReplaceOperation(operation)); }
/// <summary> /// /// </summary> /// <param name="notEquality"></param> public NotEquality(INotEquality notEquality) : base(notEquality) { }
/// <summary> /// Performs some computation with the given not equality expression. /// </summary> /// <param name="notEquality"></param> public virtual void Visit(INotEquality notEquality) { this.Visit((IBinaryOperation)notEquality); }
public void Visit(INotEquality notEquality) { throw new NotImplementedException(); }
public override void TraverseChildren(INotEquality nonEqual) { if ((nonEqual.LeftOperand.Type.TypeCode != PrimitiveTypeCode.NotPrimitive || nonEqual.RightOperand.Type.TypeCode != PrimitiveTypeCode.NotPrimitive) && !TypeHelper.TypesAreEquivalent(nonEqual.LeftOperand.Type, nonEqual.RightOperand.Type) && (!(IsConstantNull(nonEqual.LeftOperand) || IsConstantNull(nonEqual.RightOperand))) // null is "polymorphic": it can be compared against any reference type. ) { throw new TranslationException( String.Format("Decompiler messed up: inequality's left operand is of type '{0}' but right operand is of type '{1}'.", TypeHelper.GetTypeName(nonEqual.LeftOperand.Type), TypeHelper.GetTypeName(nonEqual.RightOperand.Type) )); } base.TraverseChildren(nonEqual); Bpl.Expr rexp = TranslatedExpressions.Pop(); Bpl.Expr lexp = TranslatedExpressions.Pop(); TranslatedExpressions.Push(Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Neq, lexp, rexp)); }
private HLLocation ProcessNotEqualityExpression(INotEquality pExpression) { HLLocation locationLeftOperand = ProcessExpression(pExpression.LeftOperand); HLLocation locationRightOperand = ProcessExpression(pExpression.RightOperand); HLLocation locationTemporary = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type))); mCurrentBlock.EmitCompare(HLCompareType.NotEqual, locationTemporary, locationLeftOperand, locationRightOperand); return pExpression.ResultIsUnmodifiedLeftOperand ? locationLeftOperand : locationTemporary; }
/// <summary> /// Rewrites the given not equality expression. /// </summary> /// <param name="notEquality"></param> public virtual IExpression Rewrite(INotEquality notEquality) { return notEquality; }
public override void TraverseChildren(INotEquality notEquality) { MethodEnter(notEquality); base.TraverseChildren(notEquality); MethodExit(); }
public override void TraverseChildren(INotEquality notEquality) { base.TraverseChildren(notEquality); ((NotEquality)notEquality).Type = this.platformType.SystemBoolean; }
public override void Visit(INotEquality notEquality) { allElements.Add(new InvokInfo(Traverser, "INotEquality", notEquality)); }
/// <summary> /// Generates IL for the specified not equality. /// </summary> /// <param name="notEquality">The not equality.</param> public override void TraverseChildren(INotEquality notEquality) { this.Traverse(notEquality.LeftOperand); this.Traverse(notEquality.RightOperand); var compileTimeConstant = notEquality.LeftOperand as ICompileTimeConstant; if (compileTimeConstant != null) { if (compileTimeConstant.Value == null) { this.generator.Emit(OperationCode.Clt_Un); this.StackSize--; return; } } compileTimeConstant = notEquality.RightOperand as ICompileTimeConstant; if (compileTimeConstant != null) { if (compileTimeConstant.Value == null) { this.generator.Emit(OperationCode.Cgt_Un); this.StackSize--; return; } } this.generator.Emit(OperationCode.Ceq); this.generator.Emit(OperationCode.Ldc_I4_0); this.generator.Emit(OperationCode.Ceq); this.StackSize--; }
public override void Visit(INotEquality notEquality) { if(Process(notEquality)){visitor.Visit(notEquality);} base.Visit(notEquality); }
/// <summary> /// Rewrites the given not equality expression. /// </summary> /// <param name="notEquality"></param> public virtual IExpression Rewrite(INotEquality notEquality) { var mutableNotEquality = notEquality as NotEquality; if (mutableNotEquality == null) return notEquality; this.RewriteChildren(mutableNotEquality); return mutableNotEquality; }
public virtual void onASTElement(INotEquality notEquality) { }
/// <summary> /// Performs some computation with the given not equality expression. /// </summary> /// <param name="notEquality"></param> public virtual void Visit(INotEquality notEquality) { }
/// <summary> /// Visits the specified not equality. /// </summary> /// <param name="notEquality">The not equality.</param> public override void Visit(INotEquality notEquality) { NotEquality mutableNotEquality = notEquality as NotEquality; if (alwaysMakeACopy || mutableNotEquality == null) mutableNotEquality = new NotEquality(notEquality); this.resultExpression = this.myCodeMutator.Visit(mutableNotEquality); }
/// <summary> /// Traverses the children of the not equality expression. /// </summary> public virtual void TraverseChildren(INotEquality notEquality) { Contract.Requires(notEquality != null); this.TraverseChildren((IBinaryOperation)notEquality); }
public void Visit(INotEquality notEquality) { this.result = this.rewriter.Rewrite((NotEquality)notEquality); }
//^ ensures this.path.Count == old(this.path.Count); /// <summary> /// Traverses the given not equality expression. /// </summary> /// <param name="notEquality"></param> public virtual void Visit(INotEquality notEquality) { if (this.stopTraversal) return; //^ int oldCount = this.path.Count; this.path.Push(notEquality); this.Visit(notEquality.LeftOperand); this.Visit(notEquality.RightOperand); //^ assume this.path.Count == oldCount+1; //True because all of the virtual methods of this class promise not to decrease this.path.Count. this.path.Pop(); }
/// <summary> /// Traverses the not equality expression. /// </summary> public void Traverse(INotEquality notEquality) { Contract.Requires(notEquality != null); if (this.preorderVisitor != null) this.preorderVisitor.Visit(notEquality); if (this.StopTraversal) return; this.TraverseChildren(notEquality); if (this.StopTraversal) return; if (this.postorderVisitor != null) this.postorderVisitor.Visit(notEquality); }
/// <summary> /// Returns a shallow copy of the given not equality expression. /// </summary> /// <param name="notEquality"></param> public NotEquality Copy(INotEquality notEquality) { Contract.Requires(notEquality != null); Contract.Ensures(Contract.Result<NotEquality>() != null); return new NotEquality(notEquality); }
public void Visit(INotEquality notEquality) { this.traverser.Traverse(notEquality); }
/// <summary> /// Returns a deep copy of the given not equality expression. /// </summary> /// <param name="notEquality"></param> public NotEquality Copy(INotEquality notEquality) { Contract.Requires(notEquality != null); Contract.Ensures(Contract.Result<NotEquality>() != null); var mutableCopy = this.shallowCopier.Copy(notEquality); this.CopyChildren((BinaryOperation)mutableCopy); return mutableCopy; }
public void Visit(INotEquality notEquality) { Contract.Requires(notEquality != null); throw new NotImplementedException(); }
public override void Visit(INotEquality nonEqual) { base.Visit(nonEqual); Bpl.Expr rexp = TranslatedExpressions.Pop(); Bpl.Expr lexp = TranslatedExpressions.Pop(); TranslatedExpressions.Push(Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Neq, lexp, rexp)); }
/// <summary> /// Visits the specified not equality. /// </summary> /// <param name="notEquality">The not equality.</param> public override void Visit(INotEquality notEquality) { NotEquality mutableNotEquality = new NotEquality(notEquality); this.resultExpression = this.myCodeCopier.DeepCopy(mutableNotEquality); }
public override void Visit(INotEquality operation) { ProcessOperation(operation); }
/// <summary> /// Returns a deep copy of the given not equality expression. /// </summary> /// <param name="notEquality"></param> public NotEquality Copy(INotEquality notEquality) { var mutableCopy = this.shallowCopier.Copy(notEquality); this.CopyChildren((BinaryOperation)mutableCopy); return mutableCopy; }
public override void Visit(INotEquality binary) { _formattedValue = Format(binary.LeftOperand) + " != " + Format(binary.RightOperand); }
/// <summary> /// Returns a shallow copy of the given not equality expression. /// </summary> /// <param name="notEquality"></param> public NotEquality Copy(INotEquality notEquality) { return new NotEquality(notEquality); }
public override void TraverseChildren(INotEquality notEquality) { var needsParen = LowerPrecedenceThanParentExpression(notEquality); var savedCurrentPrecedence = this.currentPrecedence; this.currentPrecedence = this.Precedence(notEquality); if (needsParen) this.sourceEmitterOutput.Write("("); this.Traverse(notEquality.LeftOperand); this.sourceEmitterOutput.Write(" != "); this.Traverse(notEquality.RightOperand); if (needsParen) this.sourceEmitterOutput.Write(")"); this.currentPrecedence = savedCurrentPrecedence; }
public void Visit(INotEquality notEquality) { this.result = this.copier.Copy(notEquality); }
/// <summary> /// Visits the specified not equality. /// </summary> /// <param name="notEquality">The not equality.</param> public override void Visit(INotEquality notEquality) { NotEquality mutableNotEquality = notEquality as NotEquality; if (mutableNotEquality == null) { this.resultExpression = notEquality; return; } this.resultExpression = this.myCodeMutator.Visit(mutableNotEquality); }