Permalink
Browse files

Perlito5 - perl6 - pretty-print - omit parenthesis when calling func/…

…method without args
  • Loading branch information...
1 parent f7a7e8f commit 18da02f98d633e169571affc0ae370fbc051dae0 @fglock committed Oct 17, 2013
Showing with 14 additions and 0 deletions.
  1. +6 −0 perlito5.pl
  2. +8 −0 src5/lib/Perlito5/Perl6/PrettyPrinter.pm
View
@@ -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);
@@ -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);
@@ -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 );
@@ -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 );

0 comments on commit 18da02f

Please sign in to comment.