//---------------------------------------------------------------------
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//
// @owner  Microsoft
// @backupOwner Microsoft
//---------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
namespace System.Data.Query.InternalTrees
{
    /// 
    /// A definition of a variable
    /// 
    internal sealed class VarDefOp : AncillaryOp
    {
        #region private state
        private Var m_var;
        #endregion
        #region constructors
        internal VarDefOp(Var v) : this()
        { 
            m_var = v; 
        }
        private VarDefOp() : base(OpType.VarDef) { }
        #endregion
        #region public methods
        internal static readonly VarDefOp Pattern = new VarDefOp();
        /// 
        /// 1 child - the defining expression
        /// 
        internal override int Arity { get { return 1; } }
        /// 
        /// The Var being defined
        /// 
        internal Var Var { get { return m_var; } }
        /// 
        /// Visitor pattern method
        /// 
        /// The BasicOpVisitor that is visiting this Op
        /// The Node that references this Op
        [DebuggerNonUserCode]
        internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); }
        
        /// 
        /// Visitor pattern method for visitors with a return value
        /// 
        /// The visitor
        /// The node in question
        /// An instance of TResultType
        [DebuggerNonUserCode]
        internal override TResultType Accept(BasicOpVisitorOfT v, Node n) { return v.Visit(this, n); }
        #endregion
    }
    /// 
    /// Helps define a list of VarDefOp
    /// 
    internal sealed class VarDefListOp : AncillaryOp
    {
        #region constructors
        private VarDefListOp() : base(OpType.VarDefList) { }
        #endregion
        #region public methods
        /// 
        /// singleton instance
        /// 
        internal static readonly VarDefListOp Instance = new VarDefListOp();
        internal static readonly VarDefListOp Pattern = Instance;
        /// 
        /// Visitor pattern method
        /// 
        /// The BasicOpVisitor that is visiting this Op
        /// The Node that references this Op
        [DebuggerNonUserCode]
        internal override void Accept(BasicOpVisitor v, Node n) { v.Visit(this, n); }
        
        /// 
        /// Visitor pattern method for visitors with a return value
        /// 
        /// The visitor
        /// The node in question
        /// An instance of TResultType
        [DebuggerNonUserCode]
        internal override TResultType Accept(BasicOpVisitorOfT v, Node n) { return v.Visit(this, n); }
        #endregion
    }
}