Skip to content

Commit

Permalink
Get role code generation using the attribute meta-protocol properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Dec 7, 2009
1 parent 2069f24 commit 2edef04
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Perl6/Compiler/Role.pm
Expand Up @@ -49,10 +49,18 @@ method finish($block) {
# Attributes.
my %attrs := self.attributes;
for %attrs {
my $attr := PAST::Op.new(
:pasttype('callmethod'),
:name('new'),
PAST::Var.new( :name('Attribute'), :namespace(''), :scope('package') ),
PAST::Val.new( :value(~$_), :named('name') ),
PAST::Val.new( :value(%attrs{$_}<accessor>), :named('has_accessor') ),
PAST::Val.new( :value(%attrs{$_}<rw>), :named('rw') ),
);
$decl.push(PAST::Op.new(
:pasttype('callmethod'),
:name('add_attribute'),
$metaclass, $meta_reg, ~$_
$metaclass, $meta_reg, $attr
));
}

Expand Down

0 comments on commit 2edef04

Please sign in to comment.