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

[svn:parrot] r33865 - in trunk/languages/perl6/src: classes parser

From:
pmichaud
Date:
December 13, 2008 13:14
Subject:
[svn:parrot] r33865 - in trunk/languages/perl6/src: classes parser
Message ID:
20081213211424.D98AECBAC8@x12.develooper.com
Author: pmichaud
Date: Sat Dec 13 13:14:20 2008
New Revision: 33865

Modified:
   trunk/languages/perl6/src/classes/Failure.pir
   trunk/languages/perl6/src/parser/actions.pm

Log:
[rakudo]:  Fix initialization of $/, $0, etc. (RT #57758)
* undef objects now return undef when subscripted
* reorganized Failure.pir methods


Modified: trunk/languages/perl6/src/classes/Failure.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Failure.pir	(original)
+++ trunk/languages/perl6/src/classes/Failure.pir	Sat Dec 13 13:14:20 2008
@@ -1,8 +1,9 @@
-.namespace []
+# $Id$
+
 
 .namespace [ 'Failure' ]
 
-.sub 'onload' :anon :init :load
+.sub '' :anon :init :load
     .local pmc p6meta, failureproto, exceptionproto
     p6meta = get_hll_global ['Perl6Object'], '$!P6META'
     failureproto = p6meta.'new_class'('Failure', 'parent'=>'Undef Any', 'attr'=>'$!exception')
@@ -14,23 +15,59 @@
     set_hll_global '$WARNINGS', $P0
 .end
 
+=head2 Methods
 
-.sub '' :method :vtable('get_integer')
-    self.'!throw_unhandled'()
-    .return (0)
+=cut
+
+.sub 'ACCEPTS' :method
+    .param pmc topic
+    $I0 = defined topic
+    if $I0 goto defined
+    .return(1)
+  defined:
+    .return(0)
 .end
 
-.sub '' :method :vtable('get_number')
-    self.'!throw_unhandled'()
-    .return (0.0)
+
+.sub 'defined' :method
+    $P0 = self.'!exception'()
+    $P0['handled'] = 1
+    $P1 = get_hll_global ['Bool'], 'False'
+    .return ($P1)
 .end
 
-.sub '' :method :vtable('get_string')
-    self.'!throw_unhandled'()
-    .return ('')
+
+.sub 'handled' :method
+    .local pmc exception
+    exception = self.'!exception'()
+    $I0 = exception['handled']
+    .return ($I0)
 .end
 
 
+.sub 'perl' :method
+    .return ('undef')
+.end
+
+
+.namespace []
+.sub 'undef'
+    .param pmc x               :slurpy
+    ## 0-argument test, RT#56366
+    ## but see also C<< term:sym<undef> >> in STD.pm
+    unless x goto no_args
+    die "Obsolete use of undef; in Perl 6 please use undefine instead"
+  no_args:
+    $P0 = new 'Failure'
+    .return ($P0)
+.end
+
+
+=head2 Private methods
+
+=cut
+
+.namespace ['Failure']
 .sub '!exception' :method
     .local pmc exception
     exception = getattribute self, '$!exception'
@@ -58,49 +95,38 @@
   done:
 .end
 
-.sub 'ACCEPTS' :method
-    .param pmc topic
-    $I0 = defined topic
-    if $I0 goto defined
-    .return(1)
-  defined:
-    .return(0)
-.end
-
 
-.sub 'defined' :method
-    $P0 = self.'!exception'()
-    $P0['handled'] = 1
-    $P1 = get_hll_global ['Bool'], 'False'
-    .return ($P1)
-.end
+=head2 Vtable functions
 
+=cut
 
-.sub 'handled' :method
-    .local pmc exception
-    exception = self.'!exception'()
-    $I0 = exception['handled']
-    .return ($I0)
+.namespace ['Failure']
+.sub '' :vtable('get_integer') :method
+    self.'!throw_unhandled'()
+    .return (0)
 .end
 
+.sub '' :vtable('get_number') :method
+    self.'!throw_unhandled'()
+    .return (0.0)
+.end
 
-.sub 'perl' :method
-    .return ('undef')
+.sub '' :vtable('get_string') :method
+    self.'!throw_unhandled'()
+    .return ('')
 .end
 
+.sub '' :vtable('get_pmc_keyed') :method
+    .param pmc key
+    .return (self)
+.end
 
-.namespace []
-.sub 'undef'
-    .param pmc x               :slurpy
-    ## 0-argument test, RT#56366
-    ## but see also C<< term:sym<undef> >> in STD.pm
-    unless x goto no_args
-    die "Obsolete use of undef; in Perl 6 please use undefine instead"
-  no_args:
-    $P0 = new 'Failure'
-    .return ($P0)
+.sub '' :vtable('get_pmc_keyed_int') :method
+    .param int key
+    .return (self)
 .end
 
+
 # Local Variables:
 #   mode: pir
 #   fill-column: 100

Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm	(original)
+++ trunk/languages/perl6/src/parser/actions.pm	Sat Dec 13 13:14:20 2008
@@ -3267,7 +3267,7 @@
             $block[0].push( PAST::Var.new( :name($_),
                                            :scope('lexical'),
                                            :isdecl(1),
-                                           :viviself('Perl6Scalar') ) );
+                                           :viviself('Failure') ) );
             $block.symbol($_, :scope('lexical') );
         }
     }



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