diff options
Diffstat (limited to 'inc/lib/Twig/Node/Expression/Parent.php')
| -rw-r--r-- | inc/lib/Twig/Node/Expression/Parent.php | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/inc/lib/Twig/Node/Expression/Parent.php b/inc/lib/Twig/Node/Expression/Parent.php index 5689fe45..dcf618c0 100644 --- a/inc/lib/Twig/Node/Expression/Parent.php +++ b/inc/lib/Twig/Node/Expression/Parent.php @@ -13,14 +13,13 @@ /** * Represents a parent node. * - * @package twig - * @author Fabien Potencier <fabien@symfony.com> + * @author Fabien Potencier <fabien@symfony.com> */ class Twig_Node_Expression_Parent extends Twig_Node_Expression { public function __construct($name, $lineno, $tag = null) { - parent::__construct(array(), array('name' => $name), $lineno, $tag); + parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag); } /** @@ -30,10 +29,19 @@ class Twig_Node_Expression_Parent extends Twig_Node_Expression */ public function compile(Twig_Compiler $compiler) { - $compiler - ->raw("\$this->renderParentBlock(") - ->string($this->getAttribute('name')) - ->raw(", \$context, \$blocks)") - ; + if ($this->getAttribute('output')) { + $compiler + ->addDebugInfo($this) + ->write("\$this->displayParentBlock(") + ->string($this->getAttribute('name')) + ->raw(", \$context, \$blocks);\n") + ; + } else { + $compiler + ->raw("\$this->renderParentBlock(") + ->string($this->getAttribute('name')) + ->raw(", \$context, \$blocks)") + ; + } } } |
