Exemple #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 (ListType == LSLExpressionListType.ForLoopAfterthoughts)
            {
                return(visitor.VisitForLoopAfterthoughts(this));
            }

            if (ListType == LSLExpressionListType.LibraryFunctionCallParameters)
            {
                return(visitor.VisitLibraryFunctionCallParameters(this));
            }

            if (ListType == LSLExpressionListType.UserFunctionCallParameters)
            {
                return(visitor.VisitUserFunctionCallParameters(this));
            }

            if (ListType == LSLExpressionListType.ListInitializer)
            {
                return(visitor.VisitListLiteralInitializerList(this));
            }

            if (ListType == LSLExpressionListType.ForLoopInitExpressions)
            {
                return(visitor.VisitForLoopInitExpressions(this));
            }

            throw new InvalidOperationException("Visit " + typeof(LSLExpressionListNode) +
                                                ", unknown LSLExpressionListType.");
        }