From 362613c3024ca08de4546037916298328e21c698 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Thu, 6 May 2010 08:34:23 +0200 Subject: [PATCH] fixed node visiting for macros (macros are now visited by visitors as any other node) --- lib/Twig/Node/Module.php | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) 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) -- 1.7.2.5