summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-10-18 20:13:38 -0500
committerJesse Luehrs <doy@tozt.net>2012-10-18 20:13:38 -0500
commite610440e5b8517cb8be3446d9897509f751c7f72 (patch)
treee769fd1247141e624369564749093aef077a7196
parent9fbbb48c912e710633a521c784c53020be053aac (diff)
downloadtext-handlebars-e610440e5b8517cb8be3446d9897509f751c7f72.tar.gz
text-handlebars-e610440e5b8517cb8be3446d9897509f751c7f72.zip
don't constant-fold render_string
-rw-r--r--lib/Text/Handlebars/Compiler.pm4
1 files changed, 3 insertions, 1 deletions
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;