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

[svn:parrot] r33898 - in trunk/languages/perl6/src: builtins classes

From:
pmichaud
Date:
December 14, 2008 11:56
Subject:
[svn:parrot] r33898 - in trunk/languages/perl6/src: builtins classes
Message ID:
20081214195614.0128BCBA12@x12.develooper.com
Author: pmichaud
Date: Sun Dec 14 11:56:12 2008
New Revision: 33898

Modified:
   trunk/languages/perl6/src/builtins/control.pir
   trunk/languages/perl6/src/classes/List.pir
   trunk/languages/perl6/src/classes/Nil.pir

Log:
[rakudo]:  Fix bare return value in item and list context (RT #58770)


Modified: trunk/languages/perl6/src/builtins/control.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/control.pir	(original)
+++ trunk/languages/perl6/src/builtins/control.pir	Sun Dec 14 11:56:12 2008
@@ -31,7 +31,7 @@
     .param int has_value       :opt_flag
 
     if has_value goto have_value
-    value = 'list'()
+    value = new 'Nil'
   have_value:
     $P0         = new 'Exception'
     $P0['type'] = .CONTROL_RETURN

Modified: trunk/languages/perl6/src/classes/List.pir
==============================================================================
--- trunk/languages/perl6/src/classes/List.pir	(original)
+++ trunk/languages/perl6/src/classes/List.pir	Sun Dec 14 11:56:12 2008
@@ -228,8 +228,6 @@
   flat_loop_1:
     .local pmc elem
     elem = self[i]
-    $I0 = defined elem
-    unless $I0 goto flat_next
     $I0 = isa elem, 'Perl6Scalar'
     unless $I0 goto no_deref
     elem = deref elem

Modified: trunk/languages/perl6/src/classes/Nil.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Nil.pir	(original)
+++ trunk/languages/perl6/src/classes/Nil.pir	Sun Dec 14 11:56:12 2008
@@ -16,7 +16,7 @@
     nilproto = p6meta.'new_class'('Nil', 'parent'=>'Failure')
 .end
 
-=head2 Context methods
+=head2 Methods
 
 =over
 
@@ -30,6 +30,16 @@
     .return ($P0)
 .end
 
+
+=item 'shift'
+
+=cut
+
+.namespace ['Nil']
+.sub 'shift' :method :vtable('shift_pmc')
+    .return (self)
+.end
+
 =back
 
 =head2 Coercion methods
@@ -40,23 +50,31 @@
 
 =cut
 
+.namespace ['Nil']
 .sub 'Scalar' :method
     $P0 = new 'Failure'
     .return ($P0)
 .end
 
+
 =back
 
-=head2 Methods
+=head2 Private methods
 
-=item 'shift'
+=over
+
+=item !flatten
+
+Return an empty list when flattened.
 
 =cut
 
-.sub 'shift' :method :vtable('shift_pmc')
-    .return (self)
+.namespace ['Nil']
+.sub '!flatten' :method
+    .tailcall self.'list'()
 .end
 
+
 =back
 
 =cut



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