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

[svn:parrot] r34536 - branches/rvar/languages/perl6/src/parser

From:
pmichaud
Date:
December 28, 2008 18:28
Subject:
[svn:parrot] r34536 - branches/rvar/languages/perl6/src/parser
Message ID:
20081229022851.43E0ECB9FA@x12.develooper.com
Author: pmichaud
Date: Sun Dec 28 18:28:49 2008
New Revision: 34536

Modified:
   branches/rvar/languages/perl6/src/parser/actions.pm

Log:
[rakudo]: (simple) multisubs work again


Modified: branches/rvar/languages/perl6/src/parser/actions.pm
==============================================================================
--- branches/rvar/languages/perl6/src/parser/actions.pm	(original)
+++ branches/rvar/languages/perl6/src/parser/actions.pm	Sun Dec 28 18:28:49 2008
@@ -512,11 +512,23 @@
 
 
 method multi_declarator($/) {
-    my $sym := ~$<sym>;
-    my $past;
-    if $( $<declarator> ) {
-        $past := $( $<declarator> );
+    my $sym  := ~$<sym>;
+    my $past :=  $<declarator> ?? $( $<declarator> ) !! $( $<routine_def> );
+
+    if $past.isa(PAST::Block) {
+        # If we're declaring a multi or a proto, flag the sub as :multi,
+        # and transform the sub's container to a Perl6MultiSub.
+        if $sym eq 'multi' || $sym eq 'proto' {
+            my $pirflags := ~$past.pirflags();
+            $past.pirflags( $pirflags ~ ' :multi()' );
+            $past.loadinit().push( 
+                PAST::Op.new( :name('!TOPERL6MULTISUB'), :pasttype('call'),
+                    PAST::Var.new( :name('block'), :scope('register') )
+                )
+            );
+        }
     }
+
     make $past;
 }
 
@@ -1734,6 +1746,9 @@
     if $<variable_declarator> {
         $past := $( $<variable_declarator> );
     }
+    elsif $<routine_declarator> {
+        $past := $( $<routine_declarator> );
+    }
     make $past;
 }
 



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