From 05e527fe212cd1d305e557d82eef16b06a250bea Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sat, 26 Jan 2013 14:36:24 -0800 Subject: [PATCH] Don't instantiate a LambdaHelper for classes with no Lambdas :) --- src/Mustache/Compiler.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Mustache/Compiler.php b/src/Mustache/Compiler.php index e22d02a..f7f1d31 100644 --- a/src/Mustache/Compiler.php +++ b/src/Mustache/Compiler.php @@ -141,6 +141,24 @@ class Mustache_Compiler %s }'; + const KLASS_NO_LAMBDAS = 'walk($tree); $sections = implode("\n", $this->sections); + $klass = empty($this->sections) ? self::KLASS_NO_LAMBDAS : self::KLASS; - return sprintf($this->prepare(self::KLASS, 0, false), $name, $code, $this->getEscape('$buffer'), $sections); + return sprintf($this->prepare($klass, 0, false), $name, $code, $this->getEscape('$buffer'), $sections); } const SECTION_CALL = '