summaryrefslogtreecommitdiff
path: root/inc/lib/Twig/Node/Expression/Parent.php
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-08-01 15:20:12 -0400
committerMichael Foster <savetheinternet@tinyboard.org>2013-08-01 15:20:12 -0400
commit0fe552857468aa12097a74e08f51f5aaa983be07 (patch)
tree22dbca1be90d7086b20a077752552296abf23325 /inc/lib/Twig/Node/Expression/Parent.php
parent22f3a95e0e421de05a11633eac846df96a2a4768 (diff)
Upgrade Twig library
Diffstat (limited to 'inc/lib/Twig/Node/Expression/Parent.php')
-rw-r--r--inc/lib/Twig/Node/Expression/Parent.php24
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)")
+ ;
+ }
}
}