From: Fabien Potencier Date: Thu, 6 May 2010 06:34:23 +0000 (+0200) Subject: fixed node visiting for macros (macros are now visited by visitors as any other node) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=362613c3024ca08de4546037916298328e21c698;p=web%2Fkonrad%2Ftwig.git fixed node visiting for macros (macros are now visited by visitors as any other node) --- diff --git a/lib/Twig/Node/Module.php b/lib/Twig/Node/Module.php index d22a990..7d0e555 100644 --- a/lib/Twig/Node/Module.php +++ b/lib/Twig/Node/Module.php @@ -86,13 +86,25 @@ class Twig_Node_Module extends Twig_Node implements Twig_NodeListInterface public function getNodes() { - return array_merge(array($this->body), $this->blocks); + return array_merge(array($this->body), $this->blocks, $this->macros); } public function setNodes(array $nodes) { $this->body = array_shift($nodes); - $this->blocks = $nodes; + $this->blocks = array(); + $this->macros = array(); + foreach ($nodes as $node) + { + if ($node instanceof Twig_Node_Macro) + { + $this->macros[] = $node; + } + else + { + $this->blocks[] = $node; + } + } } public function setUsedFilters(array $filters)