]> git.donarmstrong.com Git - perltidy.git/commitdiff
elimininate wantarray
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 12 Feb 2024 00:36:16 +0000 (16:36 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 12 Feb 2024 00:36:16 +0000 (16:36 -0800)
Now only the final debug return uses wantarray

lib/Perl/Tidy.pm
lib/Perl/Tidy/Formatter.pm

index dde9e0c7bd733956a9d3c808c9b945c84ed4d687..2fe8e3805aa0faa60038382342a5af6979e4a915 100644 (file)
@@ -3126,9 +3126,9 @@ sub line_diff {
 
     my ( $s1, $s2 ) = @_;
 
-    # Given two strings, return
-    # $diff_marker = a string with carat (^) symbols indicating differences
-    # $pos1 = character position of first difference; pos1=-1 if no difference
+    # Given two strings, Return
+    #  $diff_marker = a string with carat (^) symbols indicating differences
+    #  $pos1 = character position of first difference; pos1=-1 if no difference
 
     # Form exclusive or of the strings, which has null characters where strings
     # have same common characters so non-null characters indicate character
@@ -3151,7 +3151,7 @@ sub line_diff {
             last;
         }
     }
-    return wantarray ? ( $diff_marker, $pos1 ) : $diff_marker;
+    return ( $diff_marker, $pos1 );
 } ## end sub line_diff
 
 sub compare_string_buffers {
@@ -5512,7 +5512,7 @@ sub Win_Config_Locs {
 "I dont know a sensible place to look for config files on an $os system.\n";
         return;
     }
-    return wantarray ? ( $os, $system, $allusers ) : $os;
+    return ( $os, $system, $allusers );
 } ## end sub Win_Config_Locs
 
 sub dump_config_file {
index 4dd8280889072be80e21a018400a7f94bd2535a5..17077de3be5801eb50aaff44c7a22c537ce30669 100644 (file)
@@ -21451,10 +21451,12 @@ EOM
 
 sub terminal_type_i {
 
-    #  returns type of last token on this line (terminal token), as follows:
-    #  returns # for a full-line comment
-    #  returns ' ' for a blank line
-    #  otherwise returns final token type
+    # Given:
+    #  ($ibeg, $iend) = index range of the current output buffer line
+    # Returns type of last token on this line (terminal token), as follows:
+    #   # for a full-line comment
+    #   ' ' for a blank line
+    #   otherwise returns final token type
 
     my ( $ibeg, $iend ) = @_;
 
@@ -21466,7 +21468,7 @@ sub terminal_type_i {
     if ( $type_i eq '#' ) {
         $i--;
         if ( $i < $ibeg ) {
-            return wantarray ? ( $type_i, $ibeg ) : $type_i;
+            return $type_i;
         }
         $type_i = $types_to_go[$i];
     }
@@ -21475,7 +21477,7 @@ sub terminal_type_i {
     if ( $type_i eq 'b' ) {
         $i--;
         if ( $i < $ibeg ) {
-            return wantarray ? ( $type_i, $ibeg ) : $type_i;
+            return $type_i;
         }
         $type_i = $types_to_go[$i];
     }
@@ -21492,7 +21494,7 @@ sub terminal_type_i {
     {
         $type_i = 'b';
     }
-    return wantarray ? ( $type_i, $i ) : $type_i;
+    return $type_i;
 } ## end sub terminal_type_i
 
 sub pad_array_to_go {