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

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

From:
pmichaud
Date:
December 30, 2008 14:26
Subject:
[svn:parrot] r34678 - branches/rvar/languages/perl6/src/parser
Message ID:
20081230222554.18A29CB9FA@x12.develooper.com
Author: pmichaud
Date: Tue Dec 30 14:25:53 2008
New Revision: 34678

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

Log:
[rakudo]:  Restore @_ and %_ slurpy params.


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	Tue Dec 30 14:25:53 2008
@@ -1838,6 +1838,17 @@
         my $varname    := $sigil ~ $name;
         $past := PAST::Var.new( :name($varname), :node($/) );
 
+        if $varname eq '@_' || $varname eq '%_' {
+            unless $?BLOCK.symbol($varname) {
+                $?BLOCK.symbol( $varname, :scope('lexical') );
+                my $param := PAST::Var.new( :name($varname), 
+                                            :scope('parameter'),
+                                            :slurpy(1) );
+                if $sigil eq '%' { $param.named(1); }
+                $?BLOCK[0].unshift($param);
+            }
+        }
+
         if $sigil eq '&' {
             $varname := $name;
             $past.name($varname);
@@ -1854,15 +1865,15 @@
             unless $?BLOCK.symbol($varname) {
                 $?BLOCK.symbol( $varname, :scope('lexical') );
                 $?BLOCK.arity( +$?BLOCK.arity() + 1 );
-                my $var := PAST::Var.new(:name($varname), :scope('parameter'));
-                if $twigil eq ':' { $var.named( $name ); }
+                my $param := PAST::Var.new(:name($varname), :scope('parameter'));
+                if $twigil eq ':' { $param.named( $name ); }
                 my $block := $?BLOCK[0];
                 my $i := +@($block);
                 while $i > 0 && $block[$i-1]<name> gt $varname {
                     $block[$i] := $block[$i-1];
                     $i--;
                 }
-                $block[$i] := $var;
+                $block[$i] := $param;
             }
         }
 



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