summaryrefslogtreecommitdiffstats
path: root/lib/Text/Handlebars/Compiler.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-10-14 13:20:05 -0500
committerJesse Luehrs <doy@tozt.net>2012-10-14 14:38:14 -0500
commit5170de4d15d7ff92f3c2a1897caa91928a8855ed (patch)
tree9cbb16e35da3a224979932c51ec0b97b43dfeb82 /lib/Text/Handlebars/Compiler.pm
parent91eb6cf8098bb675220e9e63111febf69f6cddfd (diff)
downloadtext-handlebars-5170de4d15d7ff92f3c2a1897caa91928a8855ed.tar.gz
text-handlebars-5170de4d15d7ff92f3c2a1897caa91928a8855ed.zip
make_array doesn't need to be a function
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;