Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Factor submethod Bool into boolification mode.
  • Loading branch information
jnthn committed Mar 9, 2016
1 parent d2e31e8 commit fac3d74
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Perl6/Metamodel/ClassHOW.nqp
Expand Up @@ -120,10 +120,10 @@ class Perl6::Metamodel::ClassHOW
my $i := 0;
my @mro := self.mro($obj);
while $i < +@mro {
my %meths := @mro[$i].HOW.method_table(@mro[$i]);
if nqp::existskey(%meths, 'Bool') {
last;
}
my $ptype := @mro[$i];
last if nqp::existskey($ptype.HOW.method_table($ptype), 'Bool');
last if nqp::can($ptype.HOW, 'submethod_table') &&
nqp::existskey($ptype.HOW.submethod_table($ptype), 'Bool');
$i := $i + 1;
}
if $i + 1 == +@mro {
Expand Down
7 changes: 5 additions & 2 deletions src/Perl6/Metamodel/Mixins.nqp
Expand Up @@ -84,8 +84,11 @@ role Perl6::Metamodel::Mixins {
}
$new_type.HOW.compose($new_type);
$new_type.HOW.set_boolification_mode($new_type,
nqp::existskey($new_type.HOW.method_table($new_type), 'Bool') ?? 0 !!
self.get_boolification_mode($obj));
nqp::existskey($new_type.HOW.method_table($new_type), 'Bool')
|| nqp::can($new_type.HOW, 'submethod_table')
&& nqp::existskey($new_type.HOW.submethod_table($new_type), 'Bool')
?? 0
!! self.get_boolification_mode($obj));
$new_type.HOW.publish_boolification_spec($new_type);

# Locate an attribute that can serve as the initialization attribute,
Expand Down

0 comments on commit fac3d74

Please sign in to comment.