Exemplo n.º 1
0
 function print_preorder($cfg_node, $visited)
 {
     if (!$cfg_node || $visited->contains($cfg_node)) {
         return;
     }
     $visited->attach($cfg_node);
     if (CFGNode::isCFGNodeStmt($cfg_node)) {
         if ($cfg_node->stmt) {
             printStmts(array($cfg_node->stmt));
         }
     } else {
         if (CFGNode::isCFGNodeCond($cfg_node)) {
             // TODO: Figure out how to print
             // conditional nodes.
             print "WARNING: Conditional node not printed\n";
         }
     }
     for ($i = 0; $i < count($cfg_node->successors); $i++) {
         CFG::print_preorder($cfg_node->successors[$i], $visited);
     }
 }