Author: pmichaud
Date: Tue Dec 30 11:56:40 2008
New Revision: 34659
Modified:
branches/rvar/languages/perl6/src/builtins/assign.pir
branches/rvar/languages/perl6/src/parser/actions.pm
Log:
[rakudo]: Fix my ($s, @a) assignment.
Modified: branches/rvar/languages/perl6/src/builtins/assign.pir
==============================================================================
--- branches/rvar/languages/perl6/src/builtins/assign.pir (original)
+++ branches/rvar/languages/perl6/src/builtins/assign.pir Tue Dec 30
11:56:40 2008
@@ -73,23 +73,41 @@
.param pmc source
## get the list of containers and sources
+ $P0 = new ['List']
+ splice $P0, list, 0, 0
+ list = $P0
source = source.'list'()
source.'!flatten'()
- ## first, temporarily mark each container with a property
- ## so we can clone it in source if needed
- .local pmc it, true
- it = iter list
+ ## now, go through our list of containers, flattening
+ ## any intermediate lists we find, and marking each
+ ## container with a property so we can clone it in source
+ ## if needed
+ .local pmc true
+ .local int i
true = box 1
+ i = 0
mark_loop:
- unless it goto mark_done
- $P0 = shift it
- setprop $P0, 'target', true
+ $I0 = elements list
+ unless i < $I0 goto mark_done
+ .local pmc cont
+ cont = list[i]
+ $I0 = isa cont, ['ObjectRef']
+ if $I0 goto mark_next
+ $I0 = isa cont, ['Perl6Array']
+ if $I0 goto mark_next
+ $I0 = does cont, 'array'
+ unless $I0 goto mark_next
+ splice list, cont, $I0, 1
+ goto mark_loop
+ mark_next:
+ setprop cont, 'target', true
+ inc i
goto mark_loop
mark_done:
## now build our 'real' source list, cloning any targets we encounter
- .local pmc slist
+ .local pmc slist, it
slist = new 'List'
it = iter source
source_loop:
Modified: branches/rvar/languages/perl6/src/parser/actions.pm
==============================================================================
--- branches/rvar/languages/perl6/src/parser/actions.pm (original)
+++ branches/rvar/languages/perl6/src/parser/actions.pm Tue Dec 30 11:56:40 2008
@@ -1733,34 +1733,44 @@
my $past := $( $<scoped> );
if $past.isa(PAST::Var) {
- my $var := $past;
- my $scope := 'lexical';
- if $sym eq 'our' {
- $scope := 'package';
- $var.lvalue(1);
- }
-
- # This is a variable declaration, so we set the scope in
- # the block. The symbol entry also tells us the
- # implementation type of the variable (itype), any
- # initial value for the variable (viviself), and
- # any type constraints (type).
- our $?BLOCK;
- $?BLOCK.symbol( $var.name(), :scope($scope) );
- $var.scope($scope);
- $var.isdecl(1);
-
- my $init_value := $var.viviself();
- my $viviself := PAST::Op.new( :pirop('new PsP'), $var<itype> );
- if $init_value { $viviself.push( $init_value ); }
- $var.viviself( $viviself );
-
- if $var<type> {
- $var := PAST::Op.new( :pirop('setprop'),
- $var, 'type', $var<type>[0] );
+ $past := PAST::Op.new( $past );
+ }
+
+ my $i := 0;
+ for @($past) {
+ if $_.isa(PAST::Var) {
+ my $var := $_;
+ my $scope := 'lexical';
+ if $sym eq 'our' {
+ $scope := 'package';
+ $var.lvalue(1);
+ }
+
+ # This is a variable declaration, so we set the scope in
+ # the block. The symbol entry also tells us the
+ # implementation type of the variable (itype), any
+ # initial value for the variable (viviself), and
+ # any type constraints (type).
+ our $?BLOCK;
+ $?BLOCK.symbol( $var.name(), :scope($scope) );
+ $var.scope($scope);
+ $var.isdecl(1);
+
+ my $init_value := $var.viviself();
+ my $viviself := PAST::Op.new( :pirop('new PsP'), $var<itype> );
+ if $init_value { $viviself.push( $init_value ); }
+ $var.viviself( $viviself );
+
+ if +@($var<type>) {
+ $var := PAST::Op.new( :pirop('setprop'),
+ $var, 'type', $var<type>[0] );
+ }
+ $past[$i] := $var;
}
- $past := $var;
+ $i++;
}
+ if +@($past) == 1 { $past := $past[0]; }
+ else { $past.name('infix:,'); $past.pasttype('call'); }
make $past;
}
@@ -1790,6 +1800,9 @@
if $<variable_declarator> {
$past := $( $<variable_declarator> );
}
+ elsif $<signature> {
+ $past := $( $<signature> );
+ }
elsif $<routine_declarator> {
$past := $( $<routine_declarator> );
}
@@ -1807,7 +1820,7 @@
}
$var.isdecl(1);
- $var<type> := List.new();
+ $var<type> := PAST::Op.new( :name('and'), :pasttype('call') );
$var<itype> := container_itype($<variable><sigil>);
make $var;
}