summaryrefslogtreecommitdiffstats
path: root/lib/Text/Handlebars/Compiler.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Text/Handlebars/Compiler.pm')
-rw-r--r--lib/Text/Handlebars/Compiler.pm14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/Text/Handlebars/Compiler.pm b/lib/Text/Handlebars/Compiler.pm
index 77c4726..d713fc1 100644
--- a/lib/Text/Handlebars/Compiler.pm
+++ b/lib/Text/Handlebars/Compiler.pm
@@ -127,11 +127,11 @@ sub _generate_block {
my $iterations = $self->make_ternary(
$self->call($node, '(is_falsy)', $name->clone),
- $self->call($node, '(make_array)', $self->parser->literal(1)),
+ $self->make_array($self->parser->literal(1)),
$self->make_ternary(
$self->is_array_ref($name->clone),
$name->clone,
- $self->call($node, '(make_array)', $self->parser->literal(1)),
+ $self->make_array($self->parser->literal(1)),
),
);
@@ -277,6 +277,16 @@ sub is_array_ref {
);
}
+sub make_array {
+ my $self = shift;
+ my (@contents) = @_;
+
+ return $self->parser->symbol('[')->clone(
+ arity => 'composer',
+ first => \@contents,
+ );
+}
+
__PACKAGE__->meta->make_immutable;
no Any::Moose;