Exemple #1
0
        private void RegisterObjectInitializerAnalyzerOnCodeBlockStart(CodeBlockStartAnalysisContext <SyntaxKind> block)
        {
            RegionsToAnalyze regionsToAnalyze = GetOrSetCachedRegionsToAnalyzeInFile(block.CodeBlock);

            var objectInitializerAnalyzer = new ObjectInitializerAnalyzer(regionsToAnalyze);

            block.RegisterSyntaxNodeAction(objectInitializerAnalyzer.AnalyzeObjectInitializers, SyntaxKind.ObjectInitializerExpression);
        }
Exemple #2
0
        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;
 }