Esempio n. 1
0
        /// <summary>
        /// Instantiate a new CodeSettings object with the same settings as the current object.
        /// </summary>
        /// <returns>a copy CodeSettings object</returns>
        public CodeSettings Clone()
        {
            // create a new settings object and set all the properties using this settings object
            var newSettings = new CodeSettings()
            {
                // set the field, not the property. Setting the property will set a bunch of
                // other properties, which may not represent their actual values.
                m_minify = this.m_minify,

                AllowEmbeddedAspNetBlocks = this.AllowEmbeddedAspNetBlocks,
                AlwaysEscapeNonAscii      = this.AlwaysEscapeNonAscii,
                AmdSupport             = this.AmdSupport,
                CollapseToLiteral      = this.CollapseToLiteral,
                ConstStatementsMozilla = this.ConstStatementsMozilla,
                DebugLookupList        = this.DebugLookupList,
                EvalLiteralExpressions = this.EvalLiteralExpressions,
                EvalTreatment          = this.EvalTreatment,
                Format = this.Format,
                IgnoreConditionalCompilation = this.IgnoreConditionalCompilation,
                IgnoreAllErrors           = this.IgnoreAllErrors,
                IgnoreErrorList           = this.IgnoreErrorList,
                IgnorePreprocessorDefines = this.IgnorePreprocessorDefines,
                IndentSize                    = this.IndentSize,
                InlineSafeStrings             = this.InlineSafeStrings,
                KillSwitch                    = this.KillSwitch,
                KnownGlobalNamesList          = this.KnownGlobalNamesList,
                LineBreakThreshold            = this.LineBreakThreshold,
                LocalRenaming                 = this.LocalRenaming,
                MacSafariQuirks               = this.MacSafariQuirks,
                ManualRenamesProperties       = this.ManualRenamesProperties,
                NoAutoRenameList              = this.NoAutoRenameList,
                OutputMode                    = this.OutputMode,
                PreprocessOnly                = this.PreprocessOnly,
                PreprocessorDefineList        = this.PreprocessorDefineList,
                PreserveFunctionNames         = this.PreserveFunctionNames,
                PreserveImportantComments     = this.PreserveImportantComments,
                QuoteObjectLiteralProperties  = this.QuoteObjectLiteralProperties,
                RemoveFunctionExpressionNames = this.RemoveFunctionExpressionNames,
                RemoveUnneededCode            = this.RemoveUnneededCode,
                RenamePairs                   = this.RenamePairs,
                ReorderScopeDeclarations      = this.ReorderScopeDeclarations,
                SourceMode                    = this.SourceMode,
                StrictMode                    = this.StrictMode,
                StripDebugStatements          = this.StripDebugStatements,
                TermSemicolons                = this.TermSemicolons,
                BlocksStartOnSameLine         = this.BlocksStartOnSameLine,
                ErrorIfNotInlineSafe          = this.ErrorIfNotInlineSafe,
                SymbolsMap                    = this.SymbolsMap,
            };

            // set the resource strings if there are any
            newSettings.AddResourceStrings(this.ResourceStrings);

            foreach (var item in this.ReplacementTokens)
            {
                newSettings.ReplacementTokens.Add(item);
            }

            foreach (var item in this.ReplacementFallbacks)
            {
                newSettings.ReplacementTokens.Add(item);
            }

            return(newSettings);
        }