public override void Visit(ICheckIfInstance checkIfInstance) { if (Process(checkIfInstance)) { visitor.Visit(checkIfInstance); } base.Visit(checkIfInstance); }
/// <summary> /// /// </summary> /// <param name="checkIfInstance"></param> public CheckIfInstance(ICheckIfInstance checkIfInstance) : base(checkIfInstance) { this.operand = checkIfInstance.Operand; this.type = checkIfInstance.TypeToCheck; }
//^ ensures this.path.Count == old(this.path.Count); /// <summary> /// Traverses the given check-if-instance expression. /// </summary> /// <param name="checkIfInstance"></param> public virtual void Visit(ICheckIfInstance checkIfInstance) { if (this.stopTraversal) return; //^ int oldCount = this.path.Count; this.path.Push(checkIfInstance); this.Visit(checkIfInstance.Operand); this.Visit(checkIfInstance.TypeToCheck); //^ 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> /// Performs some computation with the given check-if-instance expression. /// </summary> /// <param name="checkIfInstance"></param> public virtual void Visit(ICheckIfInstance checkIfInstance) { this.Visit((IExpression)checkIfInstance); }
/// <summary> /// Traverses the children of the check-if-instance expression. /// </summary> public virtual void TraverseChildren(ICheckIfInstance checkIfInstance) { Contract.Requires(checkIfInstance != null); this.TraverseChildren((IExpression)checkIfInstance); if (this.StopTraversal) return; this.Traverse(checkIfInstance.Operand); if (this.StopTraversal) return; this.Traverse(checkIfInstance.TypeToCheck); }
/// <summary> /// Performs some computation with the given check-if-instance expression. /// </summary> /// <param name="checkIfInstance"></param> public virtual void Visit(ICheckIfInstance checkIfInstance) { }
public virtual void onASTElement(ICheckIfInstance checkIfInstance) { }
public void Visit(ICheckIfInstance checkIfInstance) { this.result = this.copier.Copy(checkIfInstance); }
public override void Visit(ICheckIfInstance checkIfInstance) { allElements.Add(new InvokInfo(Traverser, "ICheckIfInstance", checkIfInstance)); }
public override void TraverseChildren(ICheckIfInstance checkIfInstance) { base.TraverseChildren(checkIfInstance); ((CheckIfInstance)checkIfInstance).Type = this.platformType.SystemBoolean; }
/// <summary> /// Generates IL for the specified check if instance. /// </summary> /// <param name="checkIfInstance">The check if instance.</param> public override void TraverseChildren(ICheckIfInstance checkIfInstance) { this.Traverse(checkIfInstance.Operand); this.generator.Emit(OperationCode.Isinst, checkIfInstance.TypeToCheck); this.generator.Emit(OperationCode.Ldnull); this.StackSize++; this.generator.Emit(OperationCode.Cgt_Un); this.StackSize--; }
public override void Visit(ICheckIfInstance checkIfInstance) { if(Process(checkIfInstance)){visitor.Visit(checkIfInstance);} base.Visit(checkIfInstance); }
public void Visit(ICheckIfInstance checkIfInstance) { this.result = this.rewriter.Rewrite(checkIfInstance); }
/// <summary> /// Rewrites the given check-if-instance expression. /// </summary> /// <param name="checkIfInstance"></param> public virtual IExpression Rewrite(ICheckIfInstance checkIfInstance) { var mutableCheckIfInstance = checkIfInstance as CheckIfInstance; if (mutableCheckIfInstance == null) return checkIfInstance; this.RewriteChildren(mutableCheckIfInstance); return mutableCheckIfInstance; }
/// <summary> /// Visits the specified check if instance. /// </summary> /// <param name="checkIfInstance">The check if instance.</param> public override void Visit(ICheckIfInstance checkIfInstance) { CheckIfInstance mutableCheckIfInstance = checkIfInstance as CheckIfInstance; if (alwaysMakeACopy || mutableCheckIfInstance == null) mutableCheckIfInstance = new CheckIfInstance(checkIfInstance); this.resultExpression = this.myCodeMutator.Visit(mutableCheckIfInstance); }
/// <summary> /// Rewrites the given check-if-instance expression. /// </summary> /// <param name="checkIfInstance"></param> public virtual IExpression Rewrite(ICheckIfInstance checkIfInstance) { return checkIfInstance; }
public override void TraverseChildren(ICheckIfInstance checkIfInstance) { var e = this.sink.FindOrCreateTypeReferenceInCodeContext(checkIfInstance.TypeToCheck); //var callTypeOf = new Bpl.NAryExpr( // checkIfInstance.Token(), // new Bpl.FunctionCall(this.sink.Heap.TypeOfFunction), // new List<Bpl.Expr>(new Bpl.IdentifierExpr(checkIfInstance.Token(), v)) // ); base.Traverse(checkIfInstance.Operand); var exp = TranslatedExpressions.Pop(); var dynTypeOfOperand = this.sink.Heap.DynamicType(exp); //var subtype = Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Subtype, dynTypeOfOperand, e); var subtype = new Bpl.NAryExpr( Bpl.Token.NoToken, new Bpl.FunctionCall(this.sink.Heap.Subtype), new List<Bpl.Expr>(new Bpl.Expr[] {dynTypeOfOperand, e}) ); var notnull = Bpl.Expr.Neq(exp, Bpl.Expr.Ident(this.sink.Heap.NullRef)); var and = Bpl.Expr.And(notnull, subtype); TranslatedExpressions.Push(and); return; }
public override void TraverseChildren(ICheckIfInstance checkIfInstance) { MethodEnter(checkIfInstance); base.TraverseChildren(checkIfInstance); MethodExit(); }
/// <summary> /// Returns a deep copy of the given check-if-instance expression. /// </summary> /// <param name="checkIfInstance"></param> public CheckIfInstance Copy(ICheckIfInstance checkIfInstance) { Contract.Requires(checkIfInstance != null); Contract.Ensures(Contract.Result<CheckIfInstance>() != null); var mutableCopy = this.shallowCopier.Copy(checkIfInstance); this.CopyChildren((Expression)mutableCopy); mutableCopy.Operand = this.Copy(mutableCopy.Operand); mutableCopy.TypeToCheck = this.Copy(mutableCopy.TypeToCheck); return mutableCopy; }
/// <summary> /// Traverses the check-if-instance expression. /// </summary> public void Traverse(ICheckIfInstance checkIfInstance) { Contract.Requires(checkIfInstance != null); if (this.preorderVisitor != null) this.preorderVisitor.Visit(checkIfInstance); if (this.StopTraversal) return; this.TraverseChildren(checkIfInstance); if (this.StopTraversal) return; if (this.postorderVisitor != null) this.postorderVisitor.Visit(checkIfInstance); }
/// <summary> /// Returns a shallow copy of the given check-if-instance expression. /// </summary> /// <param name="checkIfInstance"></param> public CheckIfInstance Copy(ICheckIfInstance checkIfInstance) { Contract.Requires(checkIfInstance != null); Contract.Ensures(Contract.Result<CheckIfInstance>() != null); return new CheckIfInstance(checkIfInstance); }
public void Visit(ICheckIfInstance checkIfInstance) { this.traverser.Traverse(checkIfInstance); }
public void Visit(ICheckIfInstance checkIfInstance) { Contract.Requires(checkIfInstance != null); throw new NotImplementedException(); }
/// <summary> /// Visits the specified check if instance. /// </summary> /// <param name="checkIfInstance">The check if instance.</param> public override void Visit(ICheckIfInstance checkIfInstance) { CheckIfInstance mutableCheckIfInstance = new CheckIfInstance(checkIfInstance); this.resultExpression = this.myCodeCopier.DeepCopy(mutableCheckIfInstance); }
public void Visit(ICheckIfInstance checkIfInstance) { throw new NotImplementedException(); }
/// <summary> /// Returns a deep copy of the given check-if-instance expression. /// </summary> /// <param name="checkIfInstance"></param> public CheckIfInstance Copy(ICheckIfInstance checkIfInstance) { var mutableCopy = this.shallowCopier.Copy(checkIfInstance); this.CopyChildren((Expression)mutableCopy); mutableCopy.Operand = this.Copy(mutableCopy.Operand); mutableCopy.TypeToCheck = this.Copy(mutableCopy.TypeToCheck); return mutableCopy; }
public override void TraverseChildren(ICheckIfInstance checkIfInstance) { var needsParen = LowerPrecedenceThanParentExpression(checkIfInstance); var savedCurrentPrecedence = this.currentPrecedence; this.currentPrecedence = this.Precedence(checkIfInstance); if (needsParen) this.sourceEmitterOutput.Write("("); this.Traverse(checkIfInstance.Operand); this.sourceEmitterOutput.Write(" is "); this.PrintTypeReference(checkIfInstance.TypeToCheck); if (needsParen) this.sourceEmitterOutput.Write(")"); this.currentPrecedence = savedCurrentPrecedence; }
/// <summary> /// Returns a shallow copy of the given check-if-instance expression. /// </summary> /// <param name="checkIfInstance"></param> public CheckIfInstance Copy(ICheckIfInstance checkIfInstance) { return new CheckIfInstance(checkIfInstance); }
/// <summary> /// Visits the specified check if instance. /// </summary> /// <param name="checkIfInstance">The check if instance.</param> public override void Visit(ICheckIfInstance checkIfInstance) { CheckIfInstance mutableCheckIfInstance = checkIfInstance as CheckIfInstance; if (mutableCheckIfInstance == null) { this.resultExpression = checkIfInstance; return; } this.resultExpression = this.myCodeMutator.Visit(mutableCheckIfInstance); }