[svn:parrot] r42055 - in trunk: src/call t/op
bacek at svn.parrot.org
bacek at svn.parrot.org
Fri Oct 23 23:16:46 UTC 2009
Author: bacek
Date: Fri Oct 23 23:16:45 2009
New Revision: 42055
URL: https://trac.parrot.org/parrot/changeset/42055
Log:
[core] Skip empty aggregates during flattening results
Modified:
trunk/src/call/args.c
trunk/t/op/calling.t
Modified: trunk/src/call/args.c
==============================================================================
--- trunk/src/call/args.c Fri Oct 23 22:49:41 2009 (r42054)
+++ trunk/src/call/args.c Fri Oct 23 23:16:45 2009 (r42055)
@@ -1765,6 +1765,10 @@
"flattened return on a non-array");
}
flat_elems = VTABLE_elements(interp, return_item);
+ if (flat_elems == 0) {
+ /* Skip empty aggregate */
+ break;
+ }
if (return_subindex < flat_elems) {
/* fetch an item out of the aggregate */
return_item = VTABLE_get_pmc_keyed_int(interp, return_item,
Modified: trunk/t/op/calling.t
==============================================================================
--- trunk/t/op/calling.t Fri Oct 23 22:49:41 2009 (r42054)
+++ trunk/t/op/calling.t Fri Oct 23 23:16:45 2009 (r42055)
@@ -7,7 +7,7 @@
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 95;
+use Parrot::Test tests => 96;
=head1 NAME
@@ -2461,6 +2461,25 @@
42
OUTPUT
+# See Rakudo RT #62730
+pir_output_is( <<'CODE', <<'OUTPUT', "Handling :flat of emtpy arguments" );
+.sub 'main'
+ $P0 = new ['Undef']
+ ($P0) = foo()
+ $S0 = typeof $P0
+ say $S0
+.end
+
+.sub 'foo'
+ .param pmc arg :slurpy
+ $S0 = typeof arg
+ say $S0
+ .return (arg :flat)
+.end
+CODE
+ResizablePMCArray
+Undef
+OUTPUT
# Local Variables:
# mode: cperl
More information about the parrot-commits
mailing list