Esempio n. 1
0
 public static void RegisterSyntaxTreeActionInNonGenerated(this ParameterLoadingAnalysisContext context,
                                                           GeneratedCodeRecognizer generatedCodeRecognizer,
                                                           Action <SyntaxTreeAnalysisContext> action) =>
 context.RegisterCompilationStartAction(csac =>
                                        csac.RegisterSyntaxTreeAction(c =>
 {
     if (ShouldAnalyze(context.GetInnerContext(), generatedCodeRecognizer, c.GetSyntaxTree(), csac.Compilation, c.Options))
     {
         action(c);
     }
 }));
Esempio n. 2
0
 public static void RegisterSyntaxNodeActionInNonGenerated <TLanguageKindEnum>(this ParameterLoadingAnalysisContext context,
                                                                               GeneratedCodeRecognizer generatedCodeRecognizer,
                                                                               Action <SyntaxNodeAnalysisContext> action,
                                                                               params TLanguageKindEnum[] syntaxKinds) where TLanguageKindEnum : struct =>
 context.RegisterSyntaxNodeAction(c =>
 {
     if (ShouldAnalyze(context.GetInnerContext(), generatedCodeRecognizer, c.GetSyntaxTree(), c.Compilation, c.Options))
     {
         action(c);
     }
 }, syntaxKinds.ToImmutableArray());