summaryrefslogtreecommitdiffstats
path: root/lib/Text/Handlebars/Compiler.pm
blob: 2150bba93a05b27ab11ee4e5417d0029d7614218 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package Text::Handlebars::Compiler;
use Any::Moose;

extends 'Text::Xslate::Compiler';

has '+syntax' => (
    default => 'Handlebars',
);

sub _generate_block {
    my $self = shift;
    my ($node) = @_;

    return (
        $self->_localize_vars($node->first),
        (map { $self->compile_ast($_) } @{ $node->second }),
    );
}

if (0) {
    our $_recursing;
    around compile_ast => sub {
        my $orig = shift;
        my $self = shift;

        my @ast = do {
            local $_recursing = 1;
            $self->$orig(@_);
        };
        use Data::Dump; ddx(\@ast) unless $_recursing;
        return @ast;
    };
}

__PACKAGE__->meta->make_immutable;
no Any::Moose;

1;