Skip to content

Commit

Permalink
Get my %h declarations init'ing a Hash correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Feb 6, 2010
1 parent 48c9903 commit 861695b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/Perl6/Actions.pm
Expand Up @@ -692,7 +692,9 @@ sub declare_variable($/, $past, $sigil, $twigil, $desigilname, $trait_list) {
# Not an attribute - need to emit delcaration here.
# First, create a container and give it a 'rw' property
# Create the container, give it a 'rw' property
my $cont := PAST::Op.new( sigiltype($sigil), :pirop('new Ps') );
my $cont := $sigil eq '%' ??
PAST::Op.new( :name('&CREATE_HASH_LOW_LEVEL'), :pasttype('call') ) !!
PAST::Op.new( sigiltype($sigil), :pirop('new Ps') );
my $true := PAST::Var.new( :name('true'), :scope('register') );
my $vivipast := PAST::Op.new( $cont, 'rw', $true, :pirop('setprop'));

Expand Down
2 changes: 2 additions & 0 deletions src/core/EnumMap.pm
Expand Up @@ -19,4 +19,6 @@ role EnumMap {
done:
}
}


}
1 change: 1 addition & 0 deletions src/core/Hash.pm
@@ -1,5 +1,6 @@
role Hash is EnumMap {
method postcircumfix:<{ }>($key) {
$key ~= $key;
Q:PIR {
.local pmc self
self = find_lex 'self'
Expand Down
5 changes: 4 additions & 1 deletion src/glue/types.pir
Expand Up @@ -57,7 +57,10 @@ subtyping relations, etc).


.sub '&CREATE_HASH_LOW_LEVEL'
.param pmc storage
.param pmc storage :optional
unless null storage goto have_storage
storage = root_new ['parrot';'Hash']
have_storage:
$P0 = get_hll_global 'Hash'
$P0 = $P0.'!select'()
$P0 = $P0.'!pun'()
Expand Down

0 comments on commit 861695b

Please sign in to comment.