Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Only use default attr init closure if the attribute is not otherwise …
…initialized. Should work even if user provides their own BUILD.
  • Loading branch information
jnthn committed Jul 7, 2011
1 parent 8de8d4b commit 672c32a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Perl6/Actions.pm
Expand Up @@ -10,6 +10,7 @@ INIT {
p6parcel => 'perl6_parcel_from_rpa__PPP',
p6listiter => 'perl6_iter_from_rpa__PPP',
p6list => 'perl6_list_from_rpa__PPPP',
attrinited => 'repr_is_attr_initialized__IPPs',

istype => 'type_check__IPP',
lcm_i => 'lcm__Iii',
Expand Down
8 changes: 4 additions & 4 deletions src/core/Mu.pm
Expand Up @@ -68,10 +68,10 @@ my class Mu {
}
}
elsif nqp::iseq_i(nqp::atpos($task, 0), 2) {
# XXX Need check if slot has already been initialized
# or not.
my $attr := nqp::getattr(self, nqp::atpos($task, 1), nqp::atpos($task, 2));
$attr = nqp::atpos($task, 3)(self, $attr);
unless nqp::attrinited(self, nqp::atpos($task, 1), nqp::atpos($task, 2)) {
my $attr := nqp::getattr(self, nqp::atpos($task, 1), nqp::atpos($task, 2));
$attr = nqp::atpos($task, 3)(self, $attr);
}
}
else {
die "Invalid BUILDPLAN";
Expand Down

0 comments on commit 672c32a

Please sign in to comment.