public override void Visit(IPopValue popValue)
 {
     if (Process(popValue))
     {
         visitor.Visit(popValue);
     }
     base.Visit(popValue);
 }
Beispiel #2
0
        public override IExpression Rewrite(IPopValue popValue)
        {
            var t = popValue.Type;

            Contract.Assume(0 < this.locals.Count);
            var local = this.locals.Pop();

            if (this.inThenBranch)
            {
                var depth = this.locals.Count;
                if (this.thenBranchPushes != null && this.thenBranchPushes.ContainsKey(depth) && local == this.thenBranchPushes[depth].Target.Definition)
                {
                    this.thenBranchPushes.Remove(depth);
                }
            }
            var be = new BoundExpression()
            {
                Definition = local, Instance = null, Type = local.Type,
            };

            return(be);
        }
Beispiel #3
0
 public override IExpression Rewrite(IPopValue popValue) {
   return this.previouslyPushedExpression;
 }
Beispiel #4
0
 /// <summary>
 /// Allocates a shallow copy of an expression that results in the value on top of the implicit operand stack and that also pops that value from the stack.
 /// </summary>
 public PopValue(IPopValue popValue)
     : base(popValue)
 {
 }
 public override void TraverseChildren(IPopValue popValue) {
   this.sourceEmitterOutput.Write("pop");
 }
Beispiel #6
0
 public void Visit(IPopValue popValue)
 {
     this.traverser.Traverse(popValue);
 }
Beispiel #7
0
 public void Visit(IPopValue popValue)
 {
     Contract.Requires(popValue != null);
       throw new NotImplementedException();
 }
Beispiel #8
0
 //^ ensures this.path.Count == old(this.path.Count);
 /// <summary>
 /// Traverses the given pop value expression.
 /// </summary>
 /// <param name="popValue"></param>
 public virtual void Visit(IPopValue popValue)
 {
     if (this.stopTraversal) return;
 }
Beispiel #9
0
 /// <summary>
 /// Traverses the pop value expression.
 /// </summary>
 public void Traverse(IPopValue popValue)
 {
     Contract.Requires(popValue != null);
       if (this.preorderVisitor != null) this.preorderVisitor.Visit(popValue);
       if (this.StopTraversal) return;
       this.TraverseChildren(popValue);
       if (this.StopTraversal) return;
       if (this.postorderVisitor != null) this.postorderVisitor.Visit(popValue);
 }
Beispiel #10
0
 /// <summary>
 /// Performs some computation with the given pop value expression.
 /// </summary>
 /// <param name="popValue"></param>
 public override void Visit(IPopValue popValue)
 {
     PopValue mutablePopValue = popValue as PopValue;
     if (alwaysMakeACopy || mutablePopValue == null) mutablePopValue = new PopValue(popValue);
     this.resultExpression = this.myCodeMutator.Visit(mutablePopValue);
 }
Beispiel #11
0
 public override IExpression Rewrite(IPopValue popValue)
 {
     var t = popValue.Type;
     Contract.Assume(0 < this.locals.Count);
     var local = this.locals.Pop();
     if (this.inThenBranch) {
       var depth = this.locals.Count;
       if (this.thenBranchPushes != null && this.thenBranchPushes.ContainsKey(depth) && local == this.thenBranchPushes[depth].Target.Definition)
         this.thenBranchPushes.Remove(depth);
     }
     var be = new BoundExpression() { Definition = local, Instance = null, Type = local.Type, };
     return be;
 }
Beispiel #12
0
 public override void Visit(IPopValue popValue)
 {
     allElements.Add(new InvokInfo(Traverser, "IPopValue", popValue));
 }
 /// <summary>
 /// Rewrites the given pop value expression.
 /// </summary>
 /// <param name="popValue"></param>
 public virtual IExpression Rewrite(IPopValue popValue)
 {
     return popValue;
 }
Beispiel #14
0
 public override IExpression Rewrite(IPopValue popValue)
 {
     return(base.Rewrite(popValue));
 }
Beispiel #15
0
 /// <summary>
 /// Performs some computation with the given pop value expression.
 /// </summary>
 /// <param name="popValue"></param>
 public override void TraverseChildren(IPopValue popValue)
 {
     //Do nothing. The containing expression or statement will consume the value.
 }
 public override void Visit(IPopValue popValue)
 {
     if(Process(popValue)){visitor.Visit(popValue);}
     base.Visit(popValue);
 }
Beispiel #17
0
 public void Visit(IPopValue popValue)
 {
     this.result = this.rewriter.Rewrite(popValue);
 }
Beispiel #18
0
 /// <summary>
 /// Rewrites the given pop value expression.
 /// </summary>
 /// <param name="popValue"></param>
 public virtual IExpression Rewrite(IPopValue popValue)
 {
     var mutablePopValue = popValue as PopValue;
       if (mutablePopValue == null) return popValue;
       this.RewriteChildren(mutablePopValue);
       return mutablePopValue;
 }
Beispiel #19
0
 public virtual void onASTElement(IPopValue popValue)
 {
 }
Beispiel #20
0
    /// <summary>
    /// Returns a shallow copy of the given pop value expression.
    /// </summary>
    /// <param name="popValue"></param>
    public PopValue Copy(IPopValue popValue) {
      Contract.Requires(popValue != null);
      Contract.Ensures(Contract.Result<PopValue>() != null);

      return new PopValue(popValue);
    }
        public override void TraverseChildren(IPopValue popValue)
{ MethodEnter(popValue);
            base.TraverseChildren(popValue);
     MethodExit();   }
Beispiel #22
0
    /// <summary>
    /// Returns a deep copy of the given pop value expression.
    /// </summary>
    /// <param name="popValue"></param>
    public PopValue Copy(IPopValue popValue) {
      Contract.Requires(popValue != null);
      Contract.Ensures(Contract.Result<PopValue>() != null);

      var mutableCopy = this.shallowCopier.Copy(popValue);
      this.CopyChildren((Expression)popValue);
      return mutableCopy;
    }
Beispiel #23
0
 /// <summary>
 /// Performs some computation with the given pop value expression.
 /// </summary>
 /// <param name="popValue"></param>
 public virtual void Visit(IPopValue popValue)
 {
 }
 /// <summary>
 /// Performs some computation with the given pop value expression.
 /// </summary>
 /// <param name="popValue"></param>
 public virtual void Visit(IPopValue popValue)
 {
 }
Beispiel #25
0
 /// <summary>
 /// Traverses the children of the pop value expression.
 /// </summary>
 public virtual void TraverseChildren(IPopValue popValue)
 {
     Contract.Requires(popValue != null);
       this.TraverseChildren((IExpression)popValue);
 }
Beispiel #26
0
 /// <summary>
 /// Performs some computation with the given pop value expression.
 /// </summary>
 public override void Visit(IPopValue popValue)
 {
     PopValue mutablePopValue = new PopValue(popValue);
     this.resultExpression = this.myCodeCopier.DeepCopy(mutablePopValue);
 }
Beispiel #27
0
 /// <summary>
 /// Performs some computation with the given pop value expression.
 /// </summary>
 /// <param name="popValue"></param>
 public virtual void Visit(IPopValue popValue)
 {
     this.Visit((IExpression)popValue);
 }
Beispiel #28
0
 /// <summary>
 /// Returns a deep copy of the given pop value expression.
 /// </summary>
 /// <param name="popValue"></param>
 public PopValue Copy(IPopValue popValue)
 {
     var mutableCopy = this.shallowCopier.Copy(popValue);
       this.CopyChildren((Expression)popValue);
       return mutableCopy;
 }
Beispiel #29
0
 public void Visit(IPopValue popValue)
 {
     throw new NotImplementedException();
 }
Beispiel #30
0
 /// <summary>
 /// Returns a shallow copy of the given pop value expression.
 /// </summary>
 /// <param name="popValue"></param>
 public PopValue Copy(IPopValue popValue)
 {
     return new PopValue(popValue);
 }
 public override void TraverseChildren(IPopValue popValue) {
   this.foundAPop = true;
   this.StopTraversal = true;
 }
Beispiel #32
0
 public void Visit(IPopValue popValue)
 {
     this.result = this.copier.Copy(popValue);
 }
 public virtual void onASTElement(IPopValue popValue) { }
 public override void TraverseChildren(IPopValue popValue) {
   var locExpr = this.sink.operandStack.Pop();
   this.TranslatedExpressions.Push(locExpr);
 }
Beispiel #35
0
 public override void TraverseChildren(IPopValue popValue)
 {
     MethodEnter(popValue);
     base.TraverseChildren(popValue);
     MethodExit();
 }
Beispiel #36
0
 /// <summary>
 /// Visits the specified PopValue.
 /// </summary>
 /// <param name="popValue">The PopValue.</param>
 public override void Visit(IPopValue popValue)
 {
     PopValue mutablePopValue = popValue as PopValue;
     if (mutablePopValue == null) {
       this.resultExpression = popValue;
       return;
     }
     this.resultExpression = this.myCodeMutator.Visit(mutablePopValue);
 }