private void RegisterObjectInitializerAnalyzerOnCodeBlockStart(CodeBlockStartAnalysisContext <SyntaxKind> block) { RegionsToAnalyze regionsToAnalyze = GetOrSetCachedRegionsToAnalyzeInFile(block.CodeBlock); var objectInitializerAnalyzer = new ObjectInitializerAnalyzer(regionsToAnalyze); block.RegisterSyntaxNodeAction(objectInitializerAnalyzer.AnalyzeObjectInitializers, SyntaxKind.ObjectInitializerExpression); }
public override void Initialize(AnalysisContext ctx) { ctx.RegisterCodeBlockStartAction <SyntaxKind>(block => { RegionsToAnalyze regionsToAnalyze = GetOrSetCachedRegionsToAnalyzeInFile(block.CodeBlock); ObjectInitializerAnalyzer objectInitializerAnalyzer = new ObjectInitializerAnalyzer(regionsToAnalyze); block.RegisterSyntaxNodeAction(objectInitializerAnalyzer.AnalyzeObjectInitializers, SyntaxKind.ObjectInitializerExpression); block.RegisterCodeBlockEndAction(objectInitializerAnalyzer.CodeBlockEndAction); }); }
public ObjectInitializerAnalyzer(RegionsToAnalyze regionsToAnalyze) { _regionsToAnalyze = regionsToAnalyze; }