Пример #1
0
        /// <summary>
        ///     Accept a visit from an implementor of <see cref="ILSLValidatorNodeVisitor{T}" />
        /// </summary>
        /// <typeparam name="T">The visitors return type.</typeparam>
        /// <param name="visitor">The visitor instance.</param>
        /// <returns>The value returned from this method in the visitor used to visit this node.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="visitor"/> is <c>null</c>.</exception>
        public T AcceptVisitor <T>(ILSLValidatorNodeVisitor <T> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException("visitor");
            }

            if (ExpressionType == LSLExpressionType.LibraryFunction)
            {
                return(visitor.VisitLibraryFunctionCall(this));
            }

            if (ExpressionType == LSLExpressionType.UserFunction)
            {
                return(visitor.VisitUserFunctionCall(this));
            }

            throw new InvalidOperationException(
                      typeof(LSLFunctionCallNode).Name + " could not be visited, object is in an invalid state");
        }