Skip to content

Commit

Permalink
Perlito5 - perl6 - pretty-print - omit parenthesis when calling func/…
Browse files Browse the repository at this point in the history
…method without args
  • Loading branch information
fglock committed Oct 17, 2013
1 parent f7a7e8f commit 18da02f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions perlito5.pl
Expand Up @@ -13063,6 +13063,9 @@ sub Perlito5::Perl6::PrettyPrinter::call {
push(@{$out}, '.');
my $d = $dd[0];
render($d, $level, $out);
if ($open eq '(' && @dd == 1) {
return()
}
$dd[0] = 'list:<,>';
push(@{$out}, $open);
op(['op' => @dd], $level, $out);
Expand All @@ -13075,6 +13078,9 @@ sub Perlito5::Perl6::PrettyPrinter::apply {
my $open = shift(@dd);
my $d = $dd[0];
render($d, $level, $out);
if ($open eq '(' && @dd == 1) {
return()
}
$dd[0] = 'list:<,>';
push(@{$out}, $open);
op(['op' => @dd], $level, $out);
Expand Down
8 changes: 8 additions & 0 deletions src5/lib/Perlito5/Perl6/PrettyPrinter.pm
Expand Up @@ -276,6 +276,10 @@ sub call {
push @$out, '.';
my $d = $dd[0];
render( $d, $level, $out );
if ($open eq '(' && @dd == 1) {
# done if it is an empty list
return;
}
$dd[0] = 'list:<,>';
push @$out, $open;
op( [ op => @dd ], $level, $out );
Expand All @@ -289,6 +293,10 @@ sub apply {
my $open = shift @dd;
my $d = $dd[0];
render( $d, $level, $out );
if ($open eq '(' && @dd == 1) {
# done if it is an empty list
return;
}
$dd[0] = 'list:<,>';
push @$out, $open;
op( [ op => @dd ], $level, $out );
Expand Down

0 comments on commit 18da02f

Please sign in to comment.