Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix subtly buggy code that used to work for entirely the wrong reason…
…. Deals with another regression.
  • Loading branch information
jnthn committed Aug 31, 2012
1 parent 44f06cf commit 6c8ef80
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Perl6/Metamodel/AttributeContainer.pm
Expand Up @@ -21,12 +21,16 @@ role Perl6::Metamodel::AttributeContainer {
method compose_attributes($obj) {
my %seen_with_accessor;
my %meths := self.method_table($obj);
my %orig_meths;
for %meths {
%orig_meths{$_.key} := 1;
}
for @!attributes {
if $!attr_rw_by_default { $_.default_to_rw() }
if $_.has_accessor() {
my $acc_name := nqp::substr($_.name, 2);
nqp::die("Two or more attributes declared that both want an accessor method '$acc_name'")
if %seen_with_accessor{$acc_name} && !nqp::existskey(%meths, $acc_name);
if %seen_with_accessor{$acc_name} && !nqp::existskey(%orig_meths, $acc_name);
%seen_with_accessor{$acc_name} := 1;
}
$_.compose($obj);
Expand Down

0 comments on commit 6c8ef80

Please sign in to comment.