Пример #1
0
        public override void Initialize(AnalysisContext context)
        {
            try
            {
                var pumaContext = new PumaAnalysisContext(context);

                //add the analyzers
                foreach (var analyzer in Analyzers)
                {
                    switch (analyzer)
                    {
                    case IConfigurationFileAnalyzer _:
                        _configurationFileAnalyzerRegisterService.Register(context, analyzer);
                        break;

                    case IAdditionalTextAnalyzer _:
                        _additionalTextAnalyzerRegisterService.Register(context, analyzer);
                        break;

                    case ISyntaxAnalyzer _:
                        _syntaxNodeAnalyzerRegisterService.Register(pumaContext, analyzer);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Пример #2
0
        public void Register(PumaAnalysisContext pumaContext, ICompilationAnalyzer analyzer)
        {
            var syntaxAnalyzer = analyzer as ISyntaxAnalyzer;

            if (syntaxAnalyzer == null)
            {
                return;
            }

            pumaContext.RegisterCompilationStartAction(RegisterPumaActions(syntaxAnalyzer));
        }