| 1 | package Text::Xslate::Compiler::HTMLTemplate; | ||
| 2 | |||
| 3 | 1 | ▶ | use 5.008_001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use warnings FATAL => 'recursion'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 0 | ▶ | use Any::Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 9 | |||
| 10 | extends qw(Text::Xslate::Compiler); | ||
| 11 | |||
| 12 | sub _generate_call { | ||
| 13 | my($self, $node) = @_; | ||
| 14 | my $callable = $node->first; # function or macro | ||
| 15 | my $args = $node->second; | ||
| 16 | |||
| 17 | my @code = $self->SUPER::_generate_call($node); | ||
| 18 | |||
| 19 | if($callable->arity eq 'name'){ | ||
| 20 | my @code_fetch_symbol = $self->compile_ast($callable); | ||
| 21 | @code = ( | ||
| 22 | $self->opcode( pushmark => undef, comment => $callable->id ), | ||
| 23 | (map { $self->push_expr($_) } @{$args}), | ||
| 24 | |||
| 25 | $self->opcode( fetch_s => $callable->value, line => $callable->line ), | ||
| 26 | $self->opcode( 'dor' => scalar(@code_fetch_symbol) + 1), | ||
| 27 | |||
| 28 | @code_fetch_symbol, | ||
| 29 | $self->opcode( 'funcall' ) | ||
| 30 | ); | ||
| 31 | }; | ||
| 32 | @code; | ||
| 33 | } | ||
| 34 | |||
| 35 | no Any::Moose; | ||
| 36 | __PACKAGE__->meta->make_immutable(); | ||
| 37 | |||
| 38 | =head1 NAME | ||
| 39 | |||
| 40 | Text::Xslate::Compiler::HTMLTemplate - An Xslate compiler to generate HTML::Template compatible intermediate code. | ||
| 41 | |||
| 42 | =head1 AUTHOR | ||
| 43 | |||
| 44 | Shigeki Morimoto E<lt>Shigeki(at)Morimo.toE<gt> | ||
| 45 | |||
| 46 | =head1 LICENSE AND COPYRIGHT | ||
| 47 | |||
| 48 | Copyright (c) 2011, Shigeki, Morimoto. All rights reserved. | ||
| 49 | |||
| 50 | This library is free software; you can redistribute it and/or modify | ||
| 51 | it under the same terms as Perl itself. | ||