Exemplo n.º 1
0
        internal static void Analyze(CSharpCompilation compilation, MethodSymbol method, BoundNode node, DiagnosticBag diagnostics)
        {
            if (compilation.Feature("checkdispose") == null)
            {
                return;
            }

            Debug.Assert(diagnostics != null);
            var walker = new DisposeCheckerPass(compilation, method, node);

            try
            {
                bool badRegion = false;
                var  returns   = walker.Analyze(ref badRegion);
                Debug.Assert(!badRegion);
                walker.AnalyzeResult(returns);
                if (walker.Diagnostics != null)
                {
                    diagnostics.AddRange(walker.Diagnostics);
                }
            }
            finally
            {
                walker.Free();
            }
        }
Exemplo n.º 2
0
        private static bool Analyze(
            CSharpCompilation compilation,
            MethodSymbol method,
            BoundBlock block,
            DiagnosticBag diagnostics)
        {
            var result = ControlFlowPass.Analyze(compilation, method, block, diagnostics);

            DataFlowPass.Analyze(compilation, method, block, diagnostics);
            DisposeCheckerPass.Analyze(compilation, method, block, diagnostics);
            return(result);
        }