develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33708 - trunk/languages/perl6/src/classes

From:
jonathan
Date:
December 9, 2008 05:53
Subject:
[svn:parrot] r33708 - trunk/languages/perl6/src/classes
Message ID:
20081209135259.04AECCB9AF@x12.develooper.com
Author: jonathan
Date: Tue Dec  9 05:52:58 2008
New Revision: 33708

Modified:
   trunk/languages/perl6/src/classes/IO.pir
   trunk/languages/perl6/src/classes/List.pir

Log:
[rakudo] Make for =$fh { ... } style loops work.

Modified: trunk/languages/perl6/src/classes/IO.pir
==============================================================================
--- trunk/languages/perl6/src/classes/IO.pir	(original)
+++ trunk/languages/perl6/src/classes/IO.pir	Tue Dec  9 05:52:58 2008
@@ -229,6 +229,22 @@
     .return($P0)
 .end
 
+.sub 'list' :method
+    .local pmc pio, res
+    $P0 = getattribute self, "$!IO"
+    pio = getattribute $P0, "$!PIO"
+    res = new 'List'
+
+  loop:
+    $S0 = pio.'readline'()
+    if $S0 == '' goto done
+    res.'push'($S0)
+    goto loop
+
+  done:
+    .return (res)
+.end
+
 .sub 'get_string' :vtable
     .tailcall self.'item'()
 .end

Modified: trunk/languages/perl6/src/classes/List.pir
==============================================================================
--- trunk/languages/perl6/src/classes/List.pir	(original)
+++ trunk/languages/perl6/src/classes/List.pir	Tue Dec  9 05:52:58 2008
@@ -240,6 +240,10 @@
     unless $I0 goto not_range
     elem = elem.'list'()
   not_range:
+    $I0 = isa elem, 'IOIterator'
+    unless $I0 goto not_ioiterator
+    elem = elem.'list'()
+  not_ioiterator:
     $I0 = does elem, 'array'
     unless $I0 goto flat_next
     splice self, elem, i, 1



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About