[svn:parrot] r35687 - trunk/languages/pipp/src/pct

[email protected]
Newsgroups perl.cvs.parrot
Message-ID <[email protected]>
Author: bernhard
Date: Sat Jan 17 06:46:35 2009
New Revision: 35687

Modified:
   trunk/languages/pipp/src/pct/actions.pm

Log:
[Pipp] Make the actions class_constant_definition and
namespace_constant_definition look the same

Modified: trunk/languages/pipp/src/pct/actions.pm
==============================================================================
--- trunk/languages/pipp/src/pct/actions.pm	(original)
+++ trunk/languages/pipp/src/pct/actions.pm	Sat Jan 17 06:46:35 2009
@@ -285,9 +285,10 @@
 method class_constant_definition($/) {
     our $?CLASS;
     our $?NS;
-    my $past := PAST::Block.new( :name('class_constant_definition') );
-    my $loadinit := $past.loadinit();
-    $loadinit.unshift(
+    my $past := PAST::Block.new(:blocktype('immediate'));
+    my $ns   := $?CLASS eq '' ?? $?NS
+                              !! $?NS ~ '\\' ~ $?CLASS ~ '::';
+    $past.loadinit().push(
         PAST::Op.new(
             :pasttype('bind'),
             PAST::Var.new(
@@ -295,7 +296,7 @@
                 :isdecl(1),
                 :scope('package'),
                 :viviself('PhpNull'),
-                :namespace( $?NS ~ '\\' ~ $?CLASS ~ '::')
+                :namespace($ns)
             ),
             $( $<literal> )
         )
@@ -305,8 +306,12 @@
 }
 
 method namespace_constant_definition($/) {
+    our $?CLASS;
     our $?NS;
-    my $past :=
+    my $past := PAST::Block.new(:blocktype('immediate'));
+    my $ns   := $?CLASS eq '' ?? $?NS
+                              !! $?NS ~ '\\' ~ $?CLASS ~ '::';
+    $past.loadinit().push(
         PAST::Op.new(
             :pasttype('bind'),
             PAST::Var.new(
@@ -314,10 +319,11 @@
                 :isdecl(1),
                 :scope('package'),
                 :viviself('PhpNull'),
-                :namespace($?NS)
+                :namespace($ns)
             ),
             $( $<literal> )
-        );
+        )
+    );
 
     make $past;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.