From 3f8fb73083b800b16a776074c07d07410e5f5e54 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sat, 18 Dec 2010 08:04:21 +0100 Subject: [PATCH] made a small performance optimization --- lib/Twig/Filter/Method.php | 2 +- lib/Twig/Node/Expression/Name.php | 2 +- lib/Twig/Test/Method.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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); } } -- 1.7.2.5