public override Node Visit(VarDefOp op, Node n)
        {
            List <Node> args        = this.ProcessChildren(n);
            Var         computedVar = (Var)this.m_destCmd.CreateComputedVar(op.Var.Type);

            this.SetMappedVar(op.Var, computedVar);
            return(this.m_destCmd.CreateNode((Op)this.m_destCmd.CreateVarDefOp(computedVar), args));
        }
示例#2
0
        public override void Visit(VarDefOp op, Node n)
        {
            VisitAncillaryOpDefault(op, n);
            AssertScalarOp(n.Child0.Op);
            var varDefOp = op;

            AssertEqualTypes(varDefOp.Var.Type, n.Child0.Op.Type);
        }
示例#3
0
        // <summary>
        // Copies a VarDefOp
        // </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(VarDefOp op, Node n)
        {
            // First create a new Var
            var children = ProcessChildren(n);

            Debug.Assert(op.Var.VarType == VarType.Computed, "Unexpected VarType");
            Var newVar = m_destCmd.CreateComputedVar(op.Var.Type);

            SetMappedVar(op.Var, newVar);
            return(m_destCmd.CreateNode(m_destCmd.CreateVarDefOp(newVar), children));
        }
示例#4
0
        public override void Visit(VarDefOp op, Node n)
        {
            var attrs = new Dictionary <string, object>();

            attrs.Add("Var", op.Var.Id);

            using (new AutoXml(this, op, attrs))
            {
                VisitChildren(n);
            }
        }
 public override void Visit(VarDefOp op, Node n)
 {
     using (new Dump.AutoXml(this, (Op)op, new Dictionary <string, object>()
     {
         {
             "Var",
             (object)op.Var.Id
         }
     }))
         this.VisitChildren(n);
 }
        public override NodeInfo Visit(ProjectOp op, Node n)
        {
            ExtendedNodeInfo extendedNodeInfo1 = this.InitExtendedNodeInfo(n);
            ExtendedNodeInfo extendedNodeInfo2 = this.GetExtendedNodeInfo(n.Child0);

            foreach (Var output in op.Outputs)
            {
                if (extendedNodeInfo2.Definitions.IsSet(output))
                {
                    extendedNodeInfo1.Definitions.Set(output);
                }
                else
                {
                    extendedNodeInfo1.ExternalReferences.Set(output);
                }
            }
            extendedNodeInfo1.NonNullableDefinitions.InitFrom(extendedNodeInfo2.NonNullableDefinitions);
            extendedNodeInfo1.NonNullableDefinitions.And(op.Outputs);
            extendedNodeInfo1.NonNullableVisibleDefinitions.InitFrom(extendedNodeInfo2.NonNullableDefinitions);
            foreach (Node child in n.Child1.Children)
            {
                VarDefOp op1      = child.Op as VarDefOp;
                NodeInfo nodeInfo = this.GetNodeInfo(child.Child0);
                extendedNodeInfo1.LocalDefinitions.Set(op1.Var);
                extendedNodeInfo1.ExternalReferences.Clear(op1.Var);
                extendedNodeInfo1.Definitions.Set(op1.Var);
                extendedNodeInfo1.ExternalReferences.Or(nodeInfo.ExternalReferences);
                if (NodeInfoVisitor.IsDefinitionNonNullable(child.Child0, extendedNodeInfo1.NonNullableVisibleDefinitions))
                {
                    extendedNodeInfo1.NonNullableDefinitions.Set(op1.Var);
                }
            }
            extendedNodeInfo1.ExternalReferences.Minus(extendedNodeInfo2.Definitions);
            extendedNodeInfo1.ExternalReferences.Or(extendedNodeInfo2.ExternalReferences);
            extendedNodeInfo1.Keys.NoKeys = true;
            if (!extendedNodeInfo2.Keys.NoKeys)
            {
                VarVec varVec1 = this.m_command.CreateVarVec(extendedNodeInfo2.Keys.KeyVars).Remap(NodeInfoVisitor.ComputeVarRemappings(n.Child1));
                VarVec varVec2 = varVec1.Clone();
                VarVec varVec3 = this.m_command.CreateVarVec(op.Outputs);
                varVec1.Minus(varVec3);
                if (varVec1.IsEmpty)
                {
                    extendedNodeInfo1.Keys.InitFrom((IEnumerable <Var>)varVec2);
                }
            }
            extendedNodeInfo1.InitRowCountFrom(extendedNodeInfo2);
            return((NodeInfo)extendedNodeInfo1);
        }
        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(VarDefOp op, Node n)
 {
     this.VisitAncillaryOpDefault((AncillaryOp)op, n);
 }
示例#9
0
 /// <summary>
 ///     Visitor pattern method for VarDefOp
 /// </summary>
 /// <param name="op"> The VarDefOp being visited </param>
 /// <param name="n"> The Node that references the Op </param>
 public virtual void Visit(VarDefOp op, Node n)
 {
     VisitAncillaryOpDefault(op, n);
 }
示例#10
0
 // <summary>
 // VarDefOp
 // </summary>
 public virtual TResultType Visit(VarDefOp op, Node n)
 {
     return(VisitAncillaryOpDefault(op, n));
 }