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(); } }