private GlobalState With()

in src/Kusto.Language/GlobalState.cs [220:292]


        private GlobalState With(
            Optional<string> domain = default(Optional<string>),
            Optional<IReadOnlyList<ClusterSymbol>> clusters = default(Optional<IReadOnlyList<ClusterSymbol>>),
            Optional<ClusterSymbol> cluster = default(Optional<ClusterSymbol>),
            Optional<DatabaseSymbol> database = default(Optional<DatabaseSymbol>),
            Optional<IReadOnlyList<FunctionSymbol>> functions = default(Optional<IReadOnlyList<FunctionSymbol>>),
            Optional<IReadOnlyList<FunctionSymbol>> aggregates = default(Optional<IReadOnlyList<FunctionSymbol>>),
            Optional<IReadOnlyList<FunctionSymbol>> plugins = default(Optional<IReadOnlyList<FunctionSymbol>>),
            Optional<IReadOnlyList<OperatorSymbol>> operators = default(Optional<IReadOnlyList<OperatorSymbol>>),
            Optional<IReadOnlyList<CommandSymbol>> commands = default(Optional<IReadOnlyList<CommandSymbol>>),
            Optional<IReadOnlyList<ParameterSymbol>> parameters = default(Optional<IReadOnlyList<ParameterSymbol>>),
            Optional<IReadOnlyList<OptionSymbol>> options = default(Optional<IReadOnlyList<OptionSymbol>>),
            Optional<IReadOnlyList<PropertyAndValue>> properties = default(Optional<IReadOnlyList<PropertyAndValue>>),
            Optional<KustoCache> cache = default(Optional<KustoCache>))
        {
            var useDomain = domain.HasValue ? domain.Value : this.Domain;
            var useClusters = clusters.HasValue ? clusters.Value : this.Clusters;
            var useCluster = cluster.HasValue ? cluster.Value : this.Cluster;
            var useDatabase = database.HasValue ? database.Value : this.Database;
            var useFunctions = functions.HasValue ? functions.Value : this.Functions;
            var useAggregates = aggregates.HasValue ? aggregates.Value : this.Aggregates;
            var usePlugins = plugins.HasValue ? plugins.Value : this.PlugIns;
            var useOperators = operators.HasValue ? operators.Value : this.Operators;
            var useCommands = commands.HasValue ? commands.Value : this.Commands;
            var useParameters = parameters.HasValue ? parameters.Value : this.Parameters;
            var useOptions = options.HasValue ? options.Value : this.Options;
            var useProperties = properties.HasValue ? properties.Value : this.Properties;
            var useCache = cache.HasValue ? cache.Value : this.Cache;

            if (useDomain != this.Domain
                || useClusters != this.Clusters
                || useCluster != this.Cluster
                || useDatabase != this.Database
                || useFunctions != this.Functions
                || useAggregates != this.Aggregates
                || usePlugins != this.PlugIns
                || useOperators != this.Operators
                || useCommands != this.Commands
                || useParameters != this.Parameters
                || useOptions != this.Options
                || useProperties != this.Properties
                || useCache != this.Cache)
            {
                return new GlobalState(
                    useDomain,
                    useClusters,
                    useCluster,
                    useDatabase,
                    useFunctions,
                    useAggregates,
                    usePlugins,
                    useOperators,
                    useCommands,
                    useParameters,
                    useOptions,
                    useProperties,
                    useCache,
                    useClusters == this.Clusters ? this.reverseClusterMap : null,
                    useClusters == this.Clusters ? this.reverseDatabaseMap : null,
                    useClusters == this.Clusters ? this.reverseTableMap : null,
                    useFunctions == this.Functions ? this.functionsMap : null,
                    useAggregates == this.Aggregates ? this.aggregatesMap : null,
                    usePlugins == this.PlugIns ? this.pluginMap : null,
                    useOperators == this.Operators ? this.operatorMap : null,
                    useCommands == this.Commands ? this.commandMap : null,
                    useOptions == this.Options ? this.optionMap : null,
                    useProperties == this.Properties ? this.propertyMap : null);
            }
            else
            {
                return this;
            }
        }