Skip to content

Commit

Permalink
Don't bother to call applier if there are no roles
Browse files Browse the repository at this point in the history
The applier logic also had a test for that, but since it is only
being called in one location, it made more sense to move the check
there.  Also, since no one is interested in the return value, don't
bother to set anything.
  • Loading branch information
lizmat committed Mar 25, 2024
1 parent 72c491f commit 2b6cfaa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Perl6/Metamodel/ConcreteRoleHOW.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Perl6::Metamodel::ConcreteRoleHOW

Perl6::Metamodel::Configuration.role_to_role_applier_type.apply(
$target, @roles_to_compose
);
) if nqp::elems(@roles_to_compose);

my @role_typecheck_list := nqp::clone(@!role_typecheck_list);
sub add_to_typecheck_list(@roles) {
Expand Down
6 changes: 1 addition & 5 deletions src/Perl6/Metamodel/RoleToRoleApplier.nqp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ my class RoleToRoleApplier {
method apply($target, @roles) {
my $HOW := $target.HOW;

# Ensure we actually have something to appply.
return nqp::list unless nqp::elems(@roles);

# Aggregate all of the methods sharing names, eliminating
# any duplicates (a method can't collide with itself).
my %meth_info;
Expand All @@ -15,6 +12,7 @@ my class RoleToRoleApplier {
my %priv_meth_providers;
my $with_submethods := $HOW.language_revision < 3; # less than 6.e
my $submethod_type := Perl6::Metamodel::Configuration.submethod_type;

for @roles {
my $role := $_;
sub build_meth_info(@methods, @meth_names, %meth_info_to_use, @meth_names_to_use, %meth_providers_to_use) {
Expand Down Expand Up @@ -299,8 +297,6 @@ my class RoleToRoleApplier {
}
}
}

1;
}

Perl6::Metamodel::Configuration.set_role_to_role_applier_type(RoleToRoleApplier);
Expand Down

0 comments on commit 2b6cfaa

Please sign in to comment.