Пример #1
0
        static void ApplyPluginsToAst(ref Microsoft.CodeAnalysis.SyntaxTree syntaxTree, CompilationOptions options, Stencil stencil, ref CompilationResult result)
        {
            Profiler.BeginSample("Code Analysis");

            // run all the syntactic code analyzers
            CompilationStatus status = CompilationStatus.Succeeded;

            result.pluginSourceCode = new Dictionary <Type, string>();

            foreach (IRoslynPluginHandler handler in stencil.GetCompilationPluginHandlers(options).OfType <IRoslynPluginHandler>())
            {
                handler.Apply(ref syntaxTree, options);
                result.pluginSourceCode[handler.GetType()] = syntaxTree.GetText().ToString();
            }
            result.status = status;
            Profiler.EndSample();
        }