/// <summary> /// Perform control flow analysis, reporting all necessary diagnostics. Returns true if the end of /// the body might be reachable... /// </summary> public static bool Analyze(CSharpCompilation compilation, Symbol member, BoundBlock block, DiagnosticBag diagnostics) { var walker = new ControlFlowPass(compilation, member, block); if (diagnostics != null) { walker._convertInsufficientExecutionStackExceptionToCancelledByStackGuardException = true; } try { bool badRegion = false; var result = walker.Analyze(ref badRegion, diagnostics); Debug.Assert(!badRegion); return(result); } catch (BoundTreeVisitor.CancelledByStackGuardException ex) when(diagnostics != null) { ex.AddAnError(diagnostics); return(true); } finally { walker.Free(); } }
/// <summary> /// Perform control flow analysis, reporting all necessary diagnostics. Returns true if the end of /// the body might be reachable.. /// </summary> public static bool Analyze(CSharpCompilation compilation, Symbol member, BoundNode node, DiagnosticBag diagnostics) { var walker = new ControlFlowPass(compilation, member, node); try { bool badRegion = false; var result = walker.Analyze(ref badRegion, diagnostics); Debug.Assert(!badRegion); return(result); } finally { walker.Free(); } }