From fab8c72d089aa3b8832f054f4f00cb90c38f01ce Mon Sep 17 00:00:00 2001 From: Jannis Grimm Date: Sun, 24 Jul 2011 22:55:34 +0200 Subject: [PATCH] fixed issue #395 --- lib/Twig/Node/Module.php | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Twig/Node/Module.php b/lib/Twig/Node/Module.php index 1af7622..5d319e6 100644 --- a/lib/Twig/Node/Module.php +++ b/lib/Twig/Node/Module.php @@ -69,16 +69,15 @@ class Twig_Node_Module extends Twig_Node $compiler ->write("public function getParent(array \$context)\n", "{\n") ->indent() - ->write("if (null === \$this->parent) {\n") - ->indent(); - ; - - $this->compileLoadTemplate($compiler, $this->getNode('parent'), '$this->parent'); - - $compiler + ->write("\$parent = ") + ->subcompile($this->getNode('parent')) + ->raw(";\n") + ->write("if(!isset(\$this->parent[\$parent])) {\n") + ->indent() + ->write("\$this->parent[\$parent] = \$this->env->loadTemplate(\$parent);\n") ->outdent() ->write("}\n\n") - ->write("return \$this->parent;\n") + ->write("return \$this->parent[\$parent];\n") ->outdent() ->write("}\n\n") ; @@ -161,6 +160,7 @@ class Twig_Node_Module extends Twig_Node } $compiler + ->write("\$parent = array()") ->write("\$this->blocks = array_replace(\n") ->indent() ; -- 1.7.2.5