Skip to content

Commit

Permalink
Need to make sure we create Array and Seq as p6opqaues.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Feb 13, 2010
1 parent d71e295 commit d4a3bc5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Perl6/Actions.pm
Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions src/builtins/Array.pir
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/builtins/Parcel.pir
Expand Up @@ -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
Expand Down

0 comments on commit d4a3bc5

Please sign in to comment.