protected string GetJavascriptWithDCE(string fileName, string expectedText = null) { var dce = new DeadCodeAnalyzer(); var analyzerSettings = new Dictionary<string, object> { {"DeadCodeElimination", true}, {"NonAggressiveVirtualMethodElimination", false}, {"WhiteList", new List<string> {@"System\.Void Program::Main\(.*\)"}} }; dce.SetConfiguration(analyzerSettings); var defaultConfiguration = MakeConfiguration(); var generatedJs = GetJavascript( Path.Combine(@"..\Tests.DCE", fileName), expectedText, makeConfiguration: () => defaultConfiguration, initializeTranslator: (translator) => { translator.AssembliesLoaded += dce.AddAssemblies; translator.AnalyzeStarted += () => dce.Analyze(translator._TypeInfoProvider); translator.MemberCanBeSkipped += dce.MemberCanBeSkipped; }); return generatedJs; }
protected string GetJavascriptWithDCE(string fileName, string expectedText = null) { var dce = new DeadCodeAnalyzer(); var analyzerSettings = new Dictionary<string, object> { {"DeadCodeElimination", true}, {"NonAggressiveVirtualMethodElimination", false}, {"WhiteList", new List<string> {@"System\.Void Program::Main\(.*\)"}} }; dce.SetConfiguration(analyzerSettings); var defaultConfiguration = MakeConfiguration(); var generatedJs = GetJavascript( Path.Combine(@"..\Tests.DCE", fileName), expectedText, makeConfiguration: () => defaultConfiguration, analyzers: new[] { dce } ); return generatedJs; }