summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-10-18 20:13:38 -0500
committerJesse Luehrs <doy@tozt.net>2013-01-02 13:56:20 -0600
commitadb96fb612699aacd3519fd3b5e0ec778922ca92 (patch)
tree7709ed667da534866abe9faba2af099b39738b1e
parent458ba9a07adb5634dd17a936411e738e13a74826 (diff)
downloadtext-handlebars-adb96fb612699aacd3519fd3b5e0ec778922ca92.tar.gz
text-handlebars-adb96fb612699aacd3519fd3b5e0ec778922ca92.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;