refactored code

This commit is contained in:
Fabien Potencier
2011-08-06 10:44:55 +02:00
parent 440d13753a
commit 26d8aff746
4 changed files with 5 additions and 14 deletions
-4
View File
@@ -102,10 +102,6 @@ class Twig_Node_Module extends Twig_Node
->write("{\n")
->indent()
;
if (null !== $this->getNode('parent')) {
$compiler->write("protected \$parent;\n\n");
}
}
protected function compileConstructor(Twig_Compiler $compiler)
+5 -4
View File
@@ -20,6 +20,7 @@ abstract class Twig_Template implements Twig_TemplateInterface
{
static protected $cache = array();
protected $parents;
protected $env;
protected $blocks;
@@ -66,13 +67,13 @@ abstract class Twig_Template implements Twig_TemplateInterface
return false;
} elseif ($parent instanceof Twig_Template) {
$name = $parent->getTemplateName();
$this->parent[$name] = $parent;
$this->parents[$name] = $parent;
$parent = $name;
} elseif (!isset($this->parent[$parent])) {
$this->parent[$parent] = $this->env->loadTemplate($parent);
} elseif (!isset($this->parents[$parent])) {
$this->parents[$parent] = $this->env->loadTemplate($parent);
}
return $this->parent[$parent];
return $this->parents[$parent];
}
abstract protected function doGetParent(array $context);
-4
View File
@@ -106,8 +106,6 @@ EOF
/* foo.twig */
class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
{
protected \$parent;
protected function doGetParent(array \$context)
{
return "layout.twig";
@@ -149,8 +147,6 @@ EOF
/* foo.twig */
class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
{
protected \$parent;
protected function doGetParent(array \$context)
{
return ((true) ? ("foo") : ("foo"));
@@ -117,8 +117,6 @@ EOF
/* foo.twig */
class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template
{
protected \$parent;
protected function doGetParent(array \$context)
{
return "layout.twig";