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

[svn:parrot] r33969 - branches/rakudoreg/languages/perl6/src/parser

From:
jonathan
Date:
December 16, 2008 10:17
Subject:
[svn:parrot] r33969 - branches/rakudoreg/languages/perl6/src/parser
Message ID:
20081216181731.5B33DCBA12@x12.develooper.com
Author: jonathan
Date: Tue Dec 16 10:17:30 2008
New Revision: 33969

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

Log:
[rakudo] Fix term action to respect namespaces. This fixes up all remaining broken spec tests, most likely (need to pull latest changes in from trunk to be sure of that, since more was unfudeged since I last sync'd).

Modified: branches/rakudoreg/languages/perl6/src/parser/actions.pm
==============================================================================
--- branches/rakudoreg/languages/perl6/src/parser/actions.pm	(original)
+++ branches/rakudoreg/languages/perl6/src/parser/actions.pm	Tue Dec 16 10:17:30 2008
@@ -2961,16 +2961,53 @@
 
 method term($/, $key) {
     my $past;
+
+    my @ns;
+    my $short_name;
+    if $<name> {
+        @ns := Perl6::Compiler.parse_name(~$<name>);
+        $short_name := @ns.pop();
+    }
+
     if $key eq 'noarg' {
-        $past := PAST::Op.new( :name( ~$<name> ), :pasttype('call') );
+        if @ns {
+            $past := PAST::Op.new(
+                PAST::Var.new(
+                    :name($short_name),
+                    :namespace(@ns),
+                    :scope('package')
+                ),
+                :pasttype('call')
+            );
+        }
+        else {
+            $past := PAST::Op.new( :name( $short_name ), :pasttype('call') );
+        }
     }
     elsif $key eq 'args' {
         $past := $($<args>);
-        $past.name( ~$<name> );
+        if @ns {
+            $past.unshift(PAST::Var.new(
+                :name($short_name),
+                :namespace(@ns),
+                :scope('package')
+            ));
+        } else {
+            $past.name( $short_name );
+        }
     }
     elsif $key eq 'func args' {
         $past := build_call( $( $<semilist> ) );
-        $past.name( ~$<name> );
+        if @ns {
+            $past.unshift(PAST::Var.new(
+                :name($short_name),
+                :namespace(@ns),
+                :scope('package')
+            ));
+        }
+        else {
+            $past.name( $short_name );
+        }
     }
     elsif $key eq 'VAR' {
         $past := PAST::Op.new(



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