Author: pmichaud
Date: Tue Dec 30 09:26:46 2008
New Revision: 34652

Modified:
   trunk/languages/perl6/src/classes/Positional.pir
   trunk/languages/perl6/src/parser/actions.pm

Log:
[rakudo]:  Fix empty slice -- e.g., @a[2..1] .  Resolves RT #61842.


Modified: trunk/languages/perl6/src/classes/Positional.pir
==============================================================================
--- trunk/languages/perl6/src/classes/Positional.pir    (original)
+++ trunk/languages/perl6/src/classes/Positional.pir    Tue Dec 30 09:26:46 2008
@@ -96,7 +96,7 @@
     .local pmc args
     args = argsblock()
     args = 'list'(args)
-    .tailcall 'postcircumfix:[ ]'(invocant, args :flat, options :flat :named)
+    .tailcall 'postcircumfix:[ ]'(invocant, args, options :flat :named)
 .end
 
 =back

Modified: trunk/languages/perl6/src/parser/actions.pm
==============================================================================
--- trunk/languages/perl6/src/parser/actions.pm (original)
+++ trunk/languages/perl6/src/parser/actions.pm Tue Dec 30 09:26:46 2008
@@ -1560,8 +1560,11 @@
 method postcircumfix($/, $key) {
     my $past;
     if $key eq '[ ]' {
-        $past := PAST::Block.new( $( $<semilist> ), :blocktype('declaration') 
);
-        $past := PAST::Op.new( $past, :name('postcircumfix:[ ]'), :node($/) );
+        $past := PAST::Op.new( :name('postcircumfix:[ ]'), :node($/) );
+        if $<semilist><EXPR> {
+            my $slice := $( $<semilist> );
+            $past.push( PAST::Block.new( $slice, :blocktype('declaration') ) );
+        }
     }
     elsif $key eq '( )' {
         $past := build_call( $( $<semilist> ) );

Reply via email to