/// <summary>
        /// Creates the control-flow graph nodes of the
        /// specified method summary.
        /// </summary>
        /// <param name="dfg">DataFlowGraph</param>
        /// <param name="summary">MethodSummary</param>
        /// <returns>IDataFlowNode</returns>
        internal static IDataFlowNode Create(DataFlowGraph dfg, MethodSummary summary)
        {
            var entryNode = new DataFlowNode(dfg, summary.ControlFlowGraph.EntryNode, summary);

            entryNode.Construct(summary.ControlFlowGraph.EntryNode, null,
                                new Dictionary <IControlFlowNode, DataFlowNode>());
            return(entryNode);
        }
        /// <summary>
        /// Constructs the data-flow graph node from the
        /// specified control-flow graph node.
        /// </summary>
        /// <param name="cfgNode">IControlFlowNode</param>
        /// <param name="previous">DataFlowNode</param>
        /// <param name="visited">Visited nodes</param>
        private void Construct(IControlFlowNode cfgNode, DataFlowNode previous,
                               Dictionary <IControlFlowNode, DataFlowNode> visited)
        {
            visited.Add(cfgNode, this);

            if (cfgNode.Statements.Count > 0)
            {
                this.Statement = cfgNode.Statements[0];
            }

            previous = this;
            for (int idx = 1; idx < cfgNode.Statements.Count; idx++)
            {
                var nextNode = new DataFlowNode(this.Graph, cfgNode, this.Summary);
                nextNode.Statement = cfgNode.Statements[idx];

                previous.ISuccessors.Add(nextNode);
                nextNode.IPredecessors.Add(previous);
                previous = nextNode;
            }

            foreach (var successor in cfgNode.ISuccessors)
            {
                if (visited.ContainsKey(successor))
                {
                    previous.ISuccessors.Add(visited[successor]);
                    visited[successor].IPredecessors.Add(previous);
                    continue;
                }

                var nextNode = new DataFlowNode(this.Graph, successor, this.Summary);
                nextNode.Construct(successor, previous, visited);
                previous.ISuccessors.Add(nextNode);
                nextNode.IPredecessors.Add(previous);
            }
        }