コード例 #1
0
        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
ファイル: BasicValidator.cs プロジェクト: dotnet/ef6tools
        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);
            }
        }
コード例 #5
0
 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);
 }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
 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));
 }