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

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

From:
tene
Date:
December 10, 2008 19:39
Subject:
[svn:parrot] r33789 - in trunk/languages/perl6/src: builtins classes
Message ID:
20081211033939.438FACBA89@x12.develooper.com
Author: tene
Date: Wed Dec 10 19:39:36 2008
New Revision: 33789

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

Log:
[rakudo]
* More fixups for the Exception class
* Add a :multi(Exception) for the 'die' op

Modified: trunk/languages/perl6/src/builtins/control.pir
==============================================================================
--- trunk/languages/perl6/src/builtins/control.pir	(original)
+++ trunk/languages/perl6/src/builtins/control.pir	Wed Dec 10 19:39:36 2008
@@ -145,27 +145,27 @@
 
 =cut
 
-.sub 'die'
+.sub 'die' :multi('Exception')
+    .param pmc ex
+    set_global '$!', ex
+    throw ex
+    .return ()
+.end
+
+.sub 'die' :multi(_)
     .param pmc list            :slurpy
     .local pmc it
     .local string message
+    .local pmc ex
 
-    message = ''
-    it = iter list
-  iter_loop:
-    unless it goto iter_end
-    $P0 = shift it
-    $S0 = $P0
-    message .= $S0
-    goto iter_loop
-  iter_end:
+    message = list.'join'('')
     if message > '' goto have_message
     message = "Died\n"
   have_message:
-    $P0 = new 'Exception'
-    $P0 = message
-    set_global '$!', $P0
-    throw $P0
+    ex = new 'Exception'
+    ex = message
+    set_global '$!', ex
+    throw ex
     .return ()
 .end
 

Modified: trunk/languages/perl6/src/classes/Failure.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Failure.pir	(original)
+++ trunk/languages/perl6/src/classes/Failure.pir	Wed Dec 10 19:39:36 2008
@@ -7,7 +7,7 @@
     p6meta = get_hll_global ['Perl6Object'], '$!P6META'
     failureproto = p6meta.'new_class'('Failure', 'parent'=>'Undef Any', 'attr'=>'$!exception')
     p6meta.'register'('Undef', 'parent'=>failureproto, 'protoobject'=>failureproto)
-    exceptionproto = p6meta.'new_class'('Perl6Exception', 'parent'=>'Any', 'attr'=>'$!exception', 'name'=>'Exception')
+    exceptionproto = p6meta.'new_class'('Perl6Exception', 'parent'=>'Any Exception', 'attr'=>'$!exception', 'name'=>'Exception')
     p6meta.'register'('Exception', 'protoobject'=>exceptionproto)
 
     $P0 = box 1



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