Пример #1
0
        public void SetConfiguration (IDictionary<string, object> analyzerSettings) {
            Configuration = new Configuration(analyzerSettings ?? new Dictionary<string, object>());

            if (Configuration.DeadCodeElimination) {
                Console.WriteLine("// Using dead code elimination (experimental). Turn " +
                                  "DeadCodeElimination off and report an issue if you encounter problems!");
            
                deadCodeInfo = new DeadCodeInfoProvider(Configuration);
            }
        }
Пример #2
0
        public DeadCodeInfoProvider(Configuration configuration) {
            this.configuration = configuration;

            types = new HashSet<TypeDefinition>();
            methods = new HashSet<MethodDefinition>();
            fields = new HashSet<FieldDefinition>();
            assemblies = new HashSet<AssemblyDefinition>();

            if (configuration.WhiteList != null &&
                configuration.WhiteList.Count > 0) {
                whiteListCache = new List<Regex>(configuration.WhiteList.Count);
                foreach (var pattern in configuration.WhiteList) {
                    Regex compiledRegex = new Regex(pattern, RegexOptions.ECMAScript | RegexOptions.Compiled);
                    whiteListCache.Add(compiledRegex);
                }
            }
        }
Пример #3
0
        public void SetConfiguration(Compiler.Configuration configuration) {
            compilerConfiguration = configuration;

            if (configuration.AnalyzerSettings != null && configuration.AnalyzerSettings.ContainsKey("DeadCodeAnalyzer")) {
                Configuration = new Configuration((Dictionary<string, object>) configuration.AnalyzerSettings["DeadCodeAnalyzer"]);
            }
            else
            {
                Configuration = new Configuration(new Dictionary<string, object>());
            }

            if (Configuration.DeadCodeElimination.GetValueOrDefault(false)) {
                Console.WriteLine("// Using dead code elimination (experimental). Turn " +
                                  "DeadCodeElimination off and report an issue if you encounter problems!");
            
                deadCodeInfo = new DeadCodeInfoProvider(Configuration);
            }
        }
Пример #4
0
 public DeadCodeInfoProvider(Configuration configuration) {
     Configuration = configuration;
     if (configuration.WhiteList != null &&
         configuration.WhiteList.Count > 0) {
         WhiteListCache = new List<Regex>(configuration.WhiteList.Count);
         foreach (var pattern in configuration.WhiteList) {
             var compiledRegex = new Regex(pattern, RegexOptions.ECMAScript | RegexOptions.Compiled);
             WhiteListCache.Add(compiledRegex);
         }
     }
 }