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

[svn:parrot] r34091 - trunk/languages/perl6/src/parser

From:
pmichaud
Date:
December 18, 2008 17:30
Subject:
[svn:parrot] r34091 - trunk/languages/perl6/src/parser
Message ID:
20081219013031.47F6FCBA12@x12.develooper.com
Author: pmichaud
Date: Thu Dec 18 17:30:29 2008
New Revision: 34091

Modified:
   trunk/languages/perl6/src/parser/actions.pm

Log:
[rakudo]:  Fix handling of $?PACKAGE, @?PACKAGE, $?CLASS, @?CLASS, etc.
These were pushing null values onto the stacks, which meant they weren't
being restored properly on exit (as discovered by November++).


Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm	(original)
+++ trunk/languages/perl6/src/parser/actions.pm	Thu Dec 18 17:30:29 2008
@@ -1691,52 +1691,31 @@
         my $decl_past := PAST::Stmts.new();
 
         if    $sym eq 'package' {
-            @?PACKAGE.unshift($?PACKAGE);
-            $?PACKAGE := $decl_past;
+            @?PACKAGE.unshift($decl_past);
         }
         ##  module isa package
         elsif $sym eq 'module' {
-            @?MODULE.unshift($?MODULE);
-            $?MODULE := $decl_past;
-
-            @?PACKAGE.unshift($?PACKAGE);
-            $?PACKAGE := $decl_past;
+            @?MODULE.unshift($decl_past);
+            @?PACKAGE.unshift($decl_past);
         }
         ##  role isa module isa package
         elsif $sym eq 'role' {
-            @?ROLE.unshift($?ROLE);
-            $?ROLE := $decl_past;
-
-            @?MODULE.unshift($?MODULE);
-            $?MODULE := $decl_past;
-
-            @?PACKAGE.unshift($?PACKAGE);
-            $?PACKAGE := $decl_past;
+            @?ROLE.unshift($decl_past);
+            @?MODULE.unshift($decl_past);
+            @?PACKAGE.unshift($decl_past);
         }
         ##  class isa module isa package
         elsif $sym eq 'class' {
-            @?CLASS.unshift($?CLASS);
-            $?CLASS := $decl_past;
-
-            @?MODULE.unshift($?MODULE);
-            $?MODULE := $decl_past;
-
-            @?PACKAGE.unshift($?PACKAGE);
-            $?PACKAGE := $decl_past;
+            @?CLASS.unshift($decl_past);
+            @?MODULE.unshift($decl_past);
+            @?PACKAGE.unshift($decl_past);
         }
         ##  grammar isa class isa module isa package
         elsif $sym eq 'grammar' {
-            @?GRAMMAR.unshift($?GRAMMAR);
-            $?GRAMMAR := $decl_past;
-
-            @?CLASS.unshift($?CLASS);
-            $?CLASS := $decl_past;
-
-            @?MODULE.unshift($?MODULE);
-            $?MODULE := $decl_past;
-
-            @?PACKAGE.unshift($?PACKAGE);
-            $?PACKAGE := $decl_past;
+            @?GRAMMAR.unshift($decl_past);
+            @?CLASS.unshift($decl_past);
+            @?MODULE.unshift($decl_past);
+            @?PACKAGE.unshift($decl_past);
         }
     }
     else {
@@ -1775,16 +1754,15 @@
             @?MODULE.shift();
             @?PACKAGE.shift();
         }
-
-        # make sure @?<magical>[0] is always the same as $?<magical>
-        $?CLASS   := @?CLASS[0];
-        $?GRAMMAR := @?GRAMMAR[0];
-        $?MODULE  := @?MODULE[0];
-        $?PACKAGE := @?PACKAGE[0];
-        $?ROLE    := @?ROLE[0];
-
         make $past;
     }
+
+    # make sure @?<magical>[0] is always the same as $?<magical>
+    $?CLASS   := @?CLASS[0];
+    $?GRAMMAR := @?GRAMMAR[0];
+    $?MODULE  := @?MODULE[0];
+    $?PACKAGE := @?PACKAGE[0];
+    $?ROLE    := @?ROLE[0];
 }
 
 



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