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

            var objectInitializerAnalyzer = new ObjectInitializerAnalyzer(regionsToAnalyze);

            block.RegisterSyntaxNodeAction(objectInitializerAnalyzer.AnalyzeObjectInitializers, SyntaxKind.ObjectInitializerExpression);
        }
Exemplo n.º 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);
            });
        }
Exemplo n.º 3
0
 public ObjectInitializerAnalyzer(RegionsToAnalyze regionsToAnalyze)
 {
     _regionsToAnalyze = regionsToAnalyze;
 }