1 //---------------------------------------------------------------------
2 // <copyright file="AnciliaryOps.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
8 //---------------------------------------------------------------------
11 using System.Collections.Generic;
12 using System.Diagnostics;
13 using System.Globalization;
15 namespace System.Data.Query.InternalTrees
18 /// A definition of a variable
20 internal sealed class VarDefOp : AncillaryOp
27 internal VarDefOp(Var v) : this()
31 private VarDefOp() : base(OpType.VarDef) { }
34 #region public methods
35 internal static readonly VarDefOp Pattern = new VarDefOp();
38 /// 1 child - the defining expression
40 internal override int Arity { get { return 1; } }
43 /// The Var being defined
45 internal Var Var { get { return m_var; } }
48 /// Visitor pattern method
50 /// <param name="v">The BasicOpVisitor that is visiting this Op</param>
51 /// <param name="n">The Node that references this Op</param>
53 internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); }
56 /// Visitor pattern method for visitors with a return value
58 /// <param name="v">The visitor</param>
59 /// <param name="n">The node in question</param>
60 /// <returns>An instance of TResultType</returns>
62 internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); }
67 /// Helps define a list of VarDefOp
69 internal sealed class VarDefListOp : AncillaryOp
72 private VarDefListOp() : base(OpType.VarDefList) { }
75 #region public methods
77 /// singleton instance
79 internal static readonly VarDefListOp Instance = new VarDefListOp();
80 internal static readonly VarDefListOp Pattern = Instance;
83 /// Visitor pattern method
85 /// <param name="v">The BasicOpVisitor that is visiting this Op</param>
86 /// <param name="n">The Node that references this Op</param>
88 internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); }
91 /// Visitor pattern method for visitors with a return value
93 /// <param name="v">The visitor</param>
94 /// <param name="n">The node in question</param>
95 /// <returns>An instance of TResultType</returns>
97 internal override TResultType Accept<TResultType>(BasicOpVisitorOfT<TResultType> v, Node n) { return v.Visit(this, n); }