Author: pmichaud
Date: Thu Nov 6 15:03:00 2008
New Revision: 32410
Modified:
branches/rakon/languages/perl6/src/classes/Array.pir
branches/rakon/languages/perl6/src/classes/List.pir
Log:
[rakudo]: Clean up !flatten, !VALUE, and item in List/Array.
* This resolves quite a few spectest failures for the branch.
Modified: branches/rakon/languages/perl6/src/classes/Array.pir
==============================================================================
--- branches/rakon/languages/perl6/src/classes/Array.pir (original)
+++ branches/rakon/languages/perl6/src/classes/Array.pir Thu Nov 6
15:03:00 2008
@@ -35,16 +35,6 @@
=over 4
-=item delete(indices :slurpy)
-
-Delete the elements specified by C<indices> from the array
-(i.e., replace them with null). We also shorten the array
-to the length of the last non-null (existing) element.
-
-=cut
-
-.namespace ['Perl6Array']
-
=item !VALUE()
Returns an ObjectRef referencing itself, unless it already is one in which
@@ -52,6 +42,8 @@
=cut
+.namespace ['Perl6Array']
+
.sub '!VALUE' :method
$I0 = isa self, 'ObjectRef'
unless $I0 goto not_ref
Modified: branches/rakon/languages/perl6/src/classes/List.pir
==============================================================================
--- branches/rakon/languages/perl6/src/classes/List.pir (original)
+++ branches/rakon/languages/perl6/src/classes/List.pir Thu Nov 6 15:03:00 2008
@@ -28,26 +28,15 @@
=cut
+.namespace ['List']
.sub '!VALUE' :method
- # Create an array with our values.
- .local pmc array, it
- array = get_hll_global "Array"
- array = array.'new'()
- it = iter self
- it_loop:
- unless it goto it_loop_end
- $P0 = shift it
- push array, $P0
- goto it_loop
- it_loop_end:
-
- # Wrap it up in an object ref and return it.
- .local pmc ref
- ref = new 'ObjectRef', array
- .return (ref)
+ # promote the list to an Array
+ $P0 = new 'Perl6Array'
+ splice $P0, self, 0, 0
+ # and return its !VALUE
+ .tailcall $P0.'!VALUE'()
.end
-
=item clone() (vtable method)
Return a clone of this list. (Clones its elements also.)
@@ -136,12 +125,6 @@
=cut
-.sub 'item' :method
- $P0 = new 'Perl6Array'
- splice $P0, self, 0, 0
- .return ($P0)
-.end
-
=item list()
@@ -224,7 +207,7 @@
elem = self[i]
$I0 = defined elem
unless $I0 goto flat_next
- $I0 = isa elem, 'Perl6Scalar'
+ $I0 = isa elem, 'ObjectRef'
if $I0 goto flat_next
$I0 = isa elem, 'Range'
unless $I0 goto not_range