Don't traverse nodes merged by another visitor

If a NodeVisitor returns an array of nodes to merge these will no longer be traversed by all other visitors. That "feature" turned out to be a real pain in the ass on some occasions ;)
This commit is contained in:
nikic 2012-03-03 16:50:45 +01:00
parent 6657ac4b76
commit 2ed6cac7c1

View File

@ -98,12 +98,6 @@ class PHPParser_NodeTraverser
$doNodes[] = array($i, array());
break;
} elseif (is_array($return)) {
// traverse replacement nodes using all visitors apart from the one that
// did the change
unset($this->visitors[$j]);
$return = $this->traverseArray($return);
$this->visitors[$j] = $visitor;
$doNodes[] = array($i, $return);
break;
} elseif (null !== $return) {