diff --git a/src/Perl6/Actions.pm b/src/Perl6/Actions.pm index 176d294dfb0..a066db6b058 100644 --- a/src/Perl6/Actions.pm +++ b/src/Perl6/Actions.pm @@ -796,6 +796,15 @@ sub declare_variable($/, $past, $sigil, $twigil, $desigilname, $trait_list) { } } + # For arrays, need to transform_to_p6opaque. XXX Find a neater way + # to do this. + if $sigil eq '@' { + get_var_traits_node($BLOCK, $name).push(PAST::Op.new( + :pirop('transform_to_p6opaque vP'), + PAST::Var.new( :name('$P0'), :scope('register') ) + )); + } + # If we've a type to init with and it's a scalar, do so. if $init_type && $sigil eq '$' { $cont.pirop('new PsP'); diff --git a/src/builtins/Array.pir b/src/builtins/Array.pir index daafb632d1a..5a9bdff62fa 100644 --- a/src/builtins/Array.pir +++ b/src/builtins/Array.pir @@ -62,6 +62,7 @@ Arrays are the mutable form of Lists. parcel = new ['Parcel'] splice parcel, values, 0, 0 $P0 = new ['Array'] + transform_to_p6opaque $P0 $P0.'!STORE'(parcel) $P1 = new ['Perl6Scalar'], $P0 .return ($P1) diff --git a/src/builtins/Parcel.pir b/src/builtins/Parcel.pir index bfeaaa4bbda..2121ac8a440 100644 --- a/src/builtins/Parcel.pir +++ b/src/builtins/Parcel.pir @@ -75,6 +75,7 @@ Return the Parcel as a Seq. .sub 'Seq' :method .local pmc seq seq = new ['Seq'] + transform_to_p6opaque seq seq.'!STORE'(self) .return (seq) .end