develooper Front page | perl.cvs.parrot | Postings from January 2009

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

From:
pmichaud
Date:
January 10, 2009 08:58
Subject:
[svn:parrot] r35343 - trunk/languages/perl6/src/parser
Message ID:
20090110165807.AC983CB9F9@x12.develooper.com
Author: pmichaud
Date: Sat Jan 10 08:58:07 2009
New Revision: 35343

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

Log:
[rakudo]:  Adjust mainline execution for compunit-scoped modules.


Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm	(original)
+++ trunk/languages/perl6/src/parser/actions.pm	Sat Jan 10 08:58:07 2009
@@ -1413,7 +1413,6 @@
     }
 
     my $block := $( $/{$key} );
-    $block.blocktype('declaration');
     $block.lexical(0);
 
     my $modulename := $<module_name>
@@ -1429,10 +1428,15 @@
 
     if $key eq 'block' {
         # A normal block acts like a BEGIN and is executed ASAP.
+        $block.blocktype('declaration');
         $block.pirflags(':load :init');
     }
-    elsif $key eq 'statement_block' && !$<module_name> {
-        $/.panic("Compilation unit cannot be anonymous");
+    elsif $key eq 'statement_block' {
+        # file-level blocks have their contents as the compunit mainline
+        if !$<module_name> {
+            $/.panic("Compilation unit cannot be anonymous");
+        }
+        $block.blocktype('immediate');
     }
 
     #  Create a node at the beginning of the block's initializer



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