internal static void Analyze(
            CSharpCompilation compilation,
            Symbol member,
            BoundNode node,
            BoundNode firstInRegion,
            BoundNode lastInRegion,
            out bool startPointIsReachable,
            out bool endPointIsReachable
            )
        {
            var walker = new RegionReachableWalker(
                compilation,
                member,
                node,
                firstInRegion,
                lastInRegion
                );
            var  diagnostics = DiagnosticBag.GetInstance();
            bool badRegion   = false;

            try
            {
                walker.Analyze(ref badRegion, diagnostics);
                startPointIsReachable =
                    badRegion || walker._regionStartPointIsReachable.GetValueOrDefault(true);
                endPointIsReachable =
                    badRegion ||
                    walker._regionEndPointIsReachable.GetValueOrDefault(walker.State.Alive);
            }
            finally
            {
                diagnostics.Free();
                walker.Free();
            }
        }
Exemple #2
0
        private void ComputeReachability()
        {
            bool startIsReachable, endIsReachable;

            if (Succeeded)
            {
                RegionReachableWalker.Analyze(_context.Compilation, _context.Member, _context.BoundNode, _context.FirstInRegion, _context.LastInRegion, out startIsReachable, out endIsReachable);
            }
            else
            {
                startIsReachable = endIsReachable = true;
            }
            Interlocked.CompareExchange(ref _regionEndPointIsReachable, endIsReachable, null);
            Interlocked.CompareExchange(ref _regionStartPointIsReachable, startIsReachable, null);
        }
 internal static void Analyze(CSharpCompilation compilation, Symbol member, BoundNode node, BoundNode firstInRegion, BoundNode lastInRegion,
     out bool startPointIsReachable, out bool endPointIsReachable)
 {
     var walker = new RegionReachableWalker(compilation, member, node, firstInRegion, lastInRegion);
     var diagnostics = DiagnosticBag.GetInstance();
     bool badRegion = false;
     try
     {
         walker.Analyze(ref badRegion, diagnostics);
         startPointIsReachable = badRegion || walker._reginStartPointIsReachable.GetValueOrDefault(true);
         endPointIsReachable = badRegion || walker._reginEndPointIsReachable.GetValueOrDefault(walker.State.Alive);
     }
     finally
     {
         diagnostics.Free();
         walker.Free();
     }
 }