diff --git a/lib/TwigStack/NodeVisitor/StackNodeVisitor.php b/lib/TwigStack/NodeVisitor/StackNodeVisitor.php index 7781779..2d3ae4c 100644 --- a/lib/TwigStack/NodeVisitor/StackNodeVisitor.php +++ b/lib/TwigStack/NodeVisitor/StackNodeVisitor.php @@ -54,7 +54,7 @@ public function leaveNode(\Twig_NodeInterface $node, \Twig_Environment $env) */ private function handleModuleNode(\Twig_Node_Module $node) { - if ($node->hasNode('body') && null === $node->getNode('parent')) { + if ($node->hasNode('body') && (!$node->hasNode('parent') || null === $node->getNode('parent'))) { $body = $node->getNode('body'); $node->setNode('body', new StackBodyNode($body)); } @@ -70,4 +70,4 @@ public function getPriority() { return -10; } -} \ No newline at end of file +}