From e610440e5b8517cb8be3446d9897509f751c7f72 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 18 Oct 2012 20:13:38 -0500 Subject: don't constant-fold render_string --- lib/Text/Handlebars/Compiler.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Text/Handlebars/Compiler.pm b/lib/Text/Handlebars/Compiler.pm index ebcce23..40314b2 100644 --- a/lib/Text/Handlebars/Compiler.pm +++ b/lib/Text/Handlebars/Compiler.pm @@ -186,7 +186,9 @@ sub _generate_unary { $self->compile_ast($node->first), $self->opcode($node->id) ); - if( $Text::Xslate::Compiler::OPTIMIZE and $self->_code_is_literal($code[0]) ) { + # render_string can't be constant folded, because it depends on the + # current vars + if ($Text::Xslate::Compiler::OPTIMIZE and $self->_code_is_literal(@code) && $node->id ne 'render_string') { $self->_fold_constants(\@code); } return @code; -- cgit v1.2.3