diff options
Diffstat (limited to 'inc/lib/Twig/Node/SandboxedModule.php')
| -rw-r--r-- | inc/lib/Twig/Node/SandboxedModule.php | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/inc/lib/Twig/Node/SandboxedModule.php b/inc/lib/Twig/Node/SandboxedModule.php index 36d9f198..be1f5daa 100644 --- a/inc/lib/Twig/Node/SandboxedModule.php +++ b/inc/lib/Twig/Node/SandboxedModule.php @@ -13,8 +13,7 @@ /** * Represents a module node. * - * @package twig - * @author Fabien Potencier <fabien@symfony.com> + * @author Fabien Potencier <fabien@symfony.com> */ class Twig_Node_SandboxedModule extends Twig_Node_Module { @@ -24,7 +23,9 @@ class Twig_Node_SandboxedModule extends Twig_Node_Module public function __construct(Twig_Node_Module $node, array $usedFilters, array $usedTags, array $usedFunctions) { - parent::__construct($node->getNode('body'), $node->getNode('parent'), $node->getNode('blocks'), $node->getNode('macros'), $node->getNode('traits'), $node->getAttribute('filename'), $node->getLine(), $node->getNodeTag()); + parent::__construct($node->getNode('body'), $node->getNode('parent'), $node->getNode('blocks'), $node->getNode('macros'), $node->getNode('traits'), $node->getAttribute('embedded_templates'), $node->getAttribute('filename'), $node->getLine(), $node->getNodeTag()); + + $this->setAttribute('index', $node->getAttribute('index')); $this->usedFilters = $usedFilters; $this->usedTags = $usedTags; @@ -33,9 +34,7 @@ class Twig_Node_SandboxedModule extends Twig_Node_Module protected function compileDisplayBody(Twig_Compiler $compiler) { - if (null === $this->getNode('parent')) { - $compiler->write("\$this->checkSecurity();\n"); - } + $compiler->write("\$this->checkSecurity();\n"); parent::compileDisplayBody($compiler); } @@ -45,7 +44,7 @@ class Twig_Node_SandboxedModule extends Twig_Node_Module parent::compileDisplayFooter($compiler); $compiler - ->write("protected function checkSecurity() {\n") + ->write("protected function checkSecurity()\n", "{\n") ->indent() ->write("\$this->env->getExtension('sandbox')->checkSecurity(\n") ->indent() @@ -54,16 +53,6 @@ class Twig_Node_SandboxedModule extends Twig_Node_Module ->write(!$this->usedFunctions ? "array()\n" : "array('".implode('\', \'', $this->usedFunctions)."')\n") ->outdent() ->write(");\n") - ; - - if (null !== $this->getNode('parent')) { - $compiler - ->raw("\n") - ->write("\$this->parent->checkSecurity();\n") - ; - } - - $compiler ->outdent() ->write("}\n\n") ; |
