[svn:parrot] r44439 - trunk/t/compilers/imcc/imcpasm
jkeenan at svn.parrot.org
jkeenan at svn.parrot.org
Wed Feb 24 02:52:28 UTC 2010
Author: jkeenan
Date: Wed Feb 24 02:52:27 2010
New Revision: 44439
URL: https://trac.parrot.org/parrot/changeset/44439
Log:
perlcritic.t objected to prototypes in Perl 5 subroutines. Modify subroutine used to generate permutations to not use prototypes.
Modified:
trunk/t/compilers/imcc/imcpasm/optc.t
Modified: trunk/t/compilers/imcc/imcpasm/optc.t
==============================================================================
--- trunk/t/compilers/imcc/imcpasm/optc.t Wed Feb 24 02:13:06 2010 (r44438)
+++ trunk/t/compilers/imcc/imcpasm/optc.t Wed Feb 24 02:52:27 2010 (r44439)
@@ -307,22 +307,9 @@
i 1 j 3 k 2
OUT
-sub permute (&@) {
- my $code = shift;
- my @idx = 0 .. $#_;
- while ( $code->( @_[@idx] ) ) {
- my $p = $#idx;
- --$p while $idx[ $p - 1 ] > $idx[$p];
- my $q = $p or return;
- push @idx, reverse splice @idx, $p;
- ++$q while $idx[ $p - 1 ] > $idx[$q];
- @idx[ $p - 1, $q ] = @idx[ $q, $p - 1 ];
- }
-}
-
my @array = ( 'i', 'j', 'k' );
my @b;
-permute { push @b, "@_" } @array;
+my_permute( sub { push @b, "@_" }, @array );
my $x;
my $y;
foreach $x (@b) {
@@ -356,7 +343,7 @@
undef @b;
@array = ( 'i', 'j', 'k', 'l' );
-permute { push @b, "@_" } @array;
+my_permute( sub { push @b, "@_" }, @array );
foreach $x (@b) {
$x =~ tr/ /,/;
$y = $x;
@@ -392,7 +379,7 @@
undef @b;
@array = ( 'i', 'j' );
-permute { push @b, "@_" } @array;
+my_permute( sub { push @b, "@_" }, @array );
foreach $x (@b) {
$x =~ tr/ /,/;
$y = $x;
@@ -419,6 +406,18 @@
OUT
}
+sub my_permute {
+ my $code = shift;
+ my @idx = 0 .. $#_;
+ while ( $code->( @_[@idx] ) ) {
+ my $p = $#idx;
+ --$p while $idx[ $p - 1 ] > $idx[$p];
+ my $q = $p or return;
+ push @idx, reverse splice @idx, $p;
+ ++$q while $idx[ $p - 1 ] > $idx[$q];
+ @idx[ $p - 1, $q ] = @idx[ $q, $p - 1 ];
+ }
+}
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
More information about the parrot-commits
mailing list