public static ReachabilityAnalysis Create(IList<ControlFlowNode> controlFlowGraph, CancellationToken cancellationToken = default(CancellationToken))
		{
			if (controlFlowGraph == null)
				throw new ArgumentNullException("controlFlowGraph");
			ReachabilityAnalysis ra = new ReachabilityAnalysis();
			// Analysing a null node can result in an empty control flow graph
			if (controlFlowGraph.Count > 0) {
				ra.stack.Push(controlFlowGraph[0]);
				while (ra.stack.Count > 0) {
					cancellationToken.ThrowIfCancellationRequested();
					ra.MarkReachable(ra.stack.Pop());
				}
			}
			ra.stack = null;
			ra.visitedNodes = null;
			return ra;
		}
Exemplo n.º 2
0
        public static ReachabilityAnalysis Create(IList <ControlFlowNode> controlFlowGraph, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (controlFlowGraph == null)
            {
                throw new ArgumentNullException("controlFlowGraph");
            }
            ReachabilityAnalysis ra = new ReachabilityAnalysis();

            // Analysing a null node can result in an empty control flow graph
            if (controlFlowGraph.Count > 0)
            {
                ra.stack.Push(controlFlowGraph[0]);
                while (ra.stack.Count > 0)
                {
                    cancellationToken.ThrowIfCancellationRequested();
                    ra.MarkReachable(ra.stack.Pop());
                }
            }
            ra.stack        = null;
            ra.visitedNodes = null;
            return(ra);
        }
				private StatementIssueCollector (GatherVisitor visitor, ReachabilityAnalysis reachability)
				{
					collectedStatements = new HashSet<Statement> ();
					this.visitor = visitor;
					this.reachability = reachability;
				}