From: Fabien Potencier Date: Sat, 18 Dec 2010 07:04:21 +0000 (+0100) Subject: made a small performance optimization X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=3f8fb73083b800b16a776074c07d07410e5f5e54;p=web%2Fkonrad%2Ftwig.git made a small performance optimization --- diff --git a/lib/Twig/Filter/Method.php b/lib/Twig/Filter/Method.php index 940e647..aa7f041 100644 --- a/lib/Twig/Filter/Method.php +++ b/lib/Twig/Filter/Method.php @@ -29,6 +29,6 @@ class Twig_Filter_Method extends Twig_Filter public function compile() { - return sprintf('$this->getEnvironment()->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); + return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); } } diff --git a/lib/Twig/Node/Expression/Name.php b/lib/Twig/Node/Expression/Name.php index ed3fe60..f447451 100644 --- a/lib/Twig/Node/Expression/Name.php +++ b/lib/Twig/Node/Expression/Name.php @@ -23,7 +23,7 @@ class Twig_Node_Expression_Name extends Twig_Node_Expression } elseif ('_context' === $this->getAttribute('name')) { $compiler->raw('$context'); } elseif ('_charset' === $this->getAttribute('name')) { - $compiler->raw('$this->getEnvironment()->getCharset()'); + $compiler->raw('$this->env->getCharset()'); } elseif ($compiler->getEnvironment()->isStrictVariables()) { $compiler->raw(sprintf('$this->getContext($context, \'%s\', \'%s\')', $this->getAttribute('name'), $this->lineno)); } else { diff --git a/lib/Twig/Test/Method.php b/lib/Twig/Test/Method.php index 758321a..ea6a44c 100644 --- a/lib/Twig/Test/Method.php +++ b/lib/Twig/Test/Method.php @@ -27,6 +27,6 @@ class Twig_Test_Method implements Twig_TestInterface public function compile() { - return sprintf('$this->getEnvironment()->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); + return sprintf('$this->env->getExtension(\'%s\')->%s', $this->extension->getName(), $this->method); } }