示例#1
0
        /// <summary>
        ///     The only special case among all scalar and ancillaryOps. Simply adds
        ///     its var to the list of unreferenced Ops
        /// </summary>
        /// <param name="op"> The VarRefOp </param>
        /// <param name="n"> Current node </param>
        public override NodeInfo Visit(VarRefOp op, Node n)
        {
            var nodeInfo = InitNodeInfo(n);

            nodeInfo.ExternalReferences.Set(op.Var);
            return(nodeInfo);
        }
示例#2
0
        internal override bool IsEquivalent(Op other)
        {
            VarRefOp varRefOp = other as VarRefOp;

            if (varRefOp != null)
            {
                return(varRefOp.Var.Equals((object)this.Var));
            }
            return(false);
        }
        public override Node Visit(VarRefOp op, Node n)
        {
            Var var;

            if (!this.m_varMap.TryGetValue(op.Var, out var))
            {
                var = op.Var;
            }
            return(this.m_destCmd.CreateNode((Op)this.m_destCmd.CreateVarRefOp(var)));
        }
示例#4
0
        // <summary>
        // Copies a VarRefOp
        // </summary>
        // <param name="op"> The Op to Copy </param>
        // <param name="n"> The Node that references the Op </param>
        // <returns> A copy of the original Node that references a copy of the original Op </returns>
        public override Node Visit(VarRefOp op, Node n)
        {
            // Look up the newVar.
            // If no var is available in the map, that implies that the Var is defined
            // outside this subtree (and it is therefore safe to use it).
            Var newVar;

            if (!m_varMap.TryGetValue(op.Var, out newVar))
            {
                newVar = op.Var;
            }
            // no children for a VarRef
            return(m_destCmd.CreateNode(m_destCmd.CreateVarRefOp(newVar)));
        }
示例#5
0
 public override void Visit(VarRefOp op, Node n)
 {
     using (new AutoString(this, op))
     {
         VisitChildren(n);
         if (null != op.Type)
         {
             WriteString("Type=");
             WriteString(op.Type.ToString());
             WriteString(", ");
         }
         WriteString("Var=");
         WriteString(op.Var.Id.ToString(CultureInfo.InvariantCulture));
     }
 }
 public override void Visit(VarRefOp op, Node n)
 {
     using (new Dump.AutoString(this, (Op)op))
     {
         this.VisitChildren(n);
         if (op.Type != null)
         {
             this.WriteString("Type=");
             this.WriteString(op.Type.ToString());
             this.WriteString(", ");
         }
         this.WriteString("Var=");
         this.WriteString(op.Var.Id.ToString((IFormatProvider)CultureInfo.InvariantCulture));
     }
 }
        internal static Dictionary <Var, Var> ComputeVarRemappings(Node varDefListNode)
        {
            Dictionary <Var, Var> dictionary = new Dictionary <Var, Var>();

            foreach (Node child in varDefListNode.Children)
            {
                VarRefOp op1 = child.Child0.Op as VarRefOp;
                if (op1 != null)
                {
                    VarDefOp op2 = child.Op as VarDefOp;
                    dictionary[op1.Var] = op2.Var;
                }
            }
            return(dictionary);
        }
 public virtual void Visit(VarRefOp op, Node n)
 {
     this.VisitScalarOpDefault((ScalarOp)op, n);
 }
示例#9
0
 /// <summary>
 ///     Visitor pattern method for VarRefOp
 /// </summary>
 /// <param name="op"> The VarRefOp being visited </param>
 /// <param name="n"> The Node that references the Op </param>
 public virtual void Visit(VarRefOp op, Node n)
 {
     VisitScalarOpDefault(op, n);
 }
示例#10
0
 // <summary>
 // VarRefOp
 // </summary>
 public virtual TResultType Visit(VarRefOp op, Node n)
 {
     return(VisitScalarOpDefault(op, n));
 }