protected final function flow(GraphNode $node)
 {
     $outBefore = $node->getAttribute(self::ATTR_FLOW_STATE_OUT);
     $outAfter = $this->branchedFlowThrough($node->getAstNode(), $node->getAttribute(self::ATTR_FLOW_STATE_IN));
     $node->setAttribute(self::ATTR_FLOW_STATE_OUT, $outAfter);
     assert('count($outBefore) === count($outAfter)');
     for ($i = 0, $c = count($outBefore); $i < $c; $i++) {
         if (false === $outBefore[$i]->equals($outAfter[$i])) {
             return true;
         }
     }
     return false;
 }
 private function prioritizeFromEntryNode(GraphNode $entry)
 {
     $worklist = array();
     $worklist[] = array($entry, $entry->getAstNode()->getAttribute('position', 0));
     while (!empty($worklist)) {
         list($current, ) = array_shift($worklist);
         /** @var $current GraphNode */
         if (null !== $current->getAttribute('priority')) {
             continue;
         }
         $current->setAttribute('priority', ++$this->priorityCounter);
         foreach ($current->getOutEdges() as $edge) {
             /** @var $edge GraphEdge */
             $destNode = $edge->getDest();
             // Implicit return is always the last node.
             if ($this->graph->isImplicitReturn($destNode)) {
                 $position = $this->astPositionCounter + 1;
             } else {
                 $position = $destNode->getAstNode()->getAttribute('position');
                 if (null === $position) {
                     throw new \RuntimeException(NodeUtil::getStringRepr($destNode->getAstNode()) . ' has no position.');
                 }
             }
             $worklist[] = array($destNode, $position);
         }
         usort($worklist, function ($a, $b) {
             return $a[1] - $b[1];
         });
     }
 }
 protected function flow(GraphNode $node)
 {
     if ($this->isForward()) {
         $outBefore = $node->getAttribute(self::ATTR_FLOW_STATE_OUT);
         $outAfter = $this->flowThrough($node->getAstNode(), $node->getAttribute(self::ATTR_FLOW_STATE_IN));
         $node->setAttribute(self::ATTR_FLOW_STATE_OUT, $outAfter);
         return false === $outBefore->equals($outAfter);
     }
     $inBefore = $node->getAttribute(self::ATTR_FLOW_STATE_IN);
     $inAfter = $this->flowThrough($node->getAstNode(), $node->getAttribute(self::ATTR_FLOW_STATE_OUT));
     $node->setAttribute(self::ATTR_FLOW_STATE_IN, $inAfter);
     return false === $inBefore->equals($inAfter);
 }