Permalink
Browse files

Fixed Sexpr view to display dotop args correctly

  • Loading branch information...
1 parent ddb705c commit 07191c00d712dfacc972aa8f17760ce34afecf7d @abw committed Feb 8, 2012
Showing with 17 additions and 2 deletions.
  1. +16 −1 lib/Template/TT3/View/Tree/Sexpr.pm
  2. +1 −1 t/parser/variables.t
@@ -18,6 +18,8 @@ use Template::TT3::Class
FILENAME_FORMAT => '<filename:%s>',
HASH_FORMAT => "<hash:%s>",
KEYWORD_FORMAT => '<keyword:%s>',
+ LIST_FORMAT => '<list:%s>',
+ HASH_FORMAT => '<hash:%s>',
NUMBER_FORMAT => '<number:%s>',
PARENS_FORMAT => "<parens:%s>",
POSTFIX_FORMAT => '<postfix:<op:%s>%s>',
@@ -217,7 +219,7 @@ sub view_dot {
my $rhs = $dot->[RHS]->view($self);
my $args = $dot->[ARGS];
$args = $args
- ? $args->view($self)
+ ? $self->view_args($args->[EXPR])
: '<args:>';
for ($lhs, $rhs, $args) {
next unless length;
@@ -241,6 +243,19 @@ sub view_parens {
}
+sub view_list {
+ my ($self, $list) = @_;
+ return $self->view_block( $list->[EXPR], $self->LIST_FORMAT );
+
+}
+
+
+sub view_hash {
+ my ($self, $hash) = @_;
+ return $self->view_block( $hash->[EXPR], $self->HASH_FORMAT );
+}
+
+
#-----------------------------------------------------------------------
# commands
#-----------------------------------------------------------------------
View
@@ -148,7 +148,7 @@ list.join(', ')
-- expect --
<dot:
<variable:list>
- <literal:join>
+ <word:join>
<args:
<squote:', '>
>

0 comments on commit 07191c0

Please sign in to comment.