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

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

From:
jonathan
Date:
January 14, 2009 13:47
Subject:
[svn:parrot] r35560 - trunk/languages/perl6/src/parser
Message ID:
20090114214654.E4A8FCB9AE@x12.develooper.com
Author: jonathan
Date: Wed Jan 14 13:46:54 2009
New Revision: 35560

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

Log:
[rakudo] Since when we are parsing a signature we may be doing it for a package now (e.g. a parameterized role), we may already have got a block created. So check for this and use the existing one if so (otherwise we lose $block<pkgdecl>).

Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm	(original)
+++ trunk/languages/perl6/src/parser/actions.pm	Wed Jan 14 13:46:54 2009
@@ -1018,8 +1018,17 @@
 method signature($/, $key) {
     our @?BLOCK;
     if $key eq 'open' {
+        our $?BLOCK_OPEN;
         my $sigpast := PAST::Op.new( :pasttype('stmts'), :node($/) );
-        my $block    := PAST::Block.new( $sigpast, :blocktype('declaration') );
+        my $block;
+        if $?BLOCK_OPEN {
+            $block := $?BLOCK_OPEN;
+            $?BLOCK_OPEN := 0;
+            $block.unshift( $sigpast);
+        }
+        else {
+            $block := PAST::Block.new( $sigpast, :blocktype('declaration') );
+        }
         $block<explicit_signature> := 1;
         @?BLOCK.unshift($block);
     }



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