Skip to content
Permalink
Browse files

Add a role's methods to the target class in order of declaration

  • Loading branch information...
niner committed May 1, 2019
1 parent 5ee341c commit 5b8b9c0c736719554067c81ca0f985fb96b93d89
Showing with 6 additions and 8 deletions.
  1. +6 −8 src/Perl6/Metamodel/RoleToClassApplier.nqp
@@ -102,11 +102,11 @@ my class RoleToClassApplier {
my @stubs;

# Compose in any methods.
sub compose_method_table(%methods) {
for %methods {
my $name := $_.key;
sub compose_method_table(@methods) {
for @methods -> $method {
my str $name := $method.name;
my $yada := 0;
try { $yada := $_.value.yada }
try { $yada := $method.yada }
if $yada {
unless has_method($target, $name, 0)
|| has_public_attribute($target, $name) {
@@ -122,13 +122,11 @@ my class RoleToClassApplier {
}
}
elsif !has_method($target, $name, 1) {
$target.HOW.add_method($target, $name, $_.value);
$target.HOW.add_method($target, $name, $method);
}
}
}
compose_method_table(nqp::hllize($to_compose_meta.method_table($to_compose)));
compose_method_table(nqp::hllize($to_compose_meta.submethod_table($to_compose)))
if nqp::can($to_compose_meta, 'submethod_table');
compose_method_table(nqp::hllize($to_compose_meta.methods($to_compose, :local(1))));
if nqp::can($to_compose_meta, 'private_method_table') {
for nqp::hllize($to_compose_meta.private_method_table($to_compose)) {
unless has_private_method($target, $_.key) {

0 comments on commit 5b8b9c0

Please sign in to comment.
You can’t perform that action at this time.