Skip to content

Instantly share code, notes, and snippets.

@hanabokuro
Created June 23, 2011 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanabokuro/1042248 to your computer and use it in GitHub Desktop.
Save hanabokuro/1042248 to your computer and use it in GitHub Desktop.
Text::Xslate enable to write 'func()' instead of '$func()'
sub _generate_call {
my($self, $node) = @_;
my $callable = $node->first; # function or macro
my $args = $node->second;
my @code = $self->SUPER::_generate_call($node);
if($callable->arity eq 'name'){
my @code_fetch_symbol = $self->compile_ast($callable);
@code = (
$self->opcode( pushmark => undef, comment => $callable->id ),
(map { $self->push_expr($_) } @{$args}),
$self->opcode( fetch_s => $callable->value, line => $callable->line ),
$self->opcode( 'or' => scalar(@code_fetch_symbol) + 1),
@code_fetch_symbol,
$self->opcode( 'funcall' )
);
};
@code;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment