Skip to content

Commit

Permalink
Add a role's methods to the target class in order of declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
niner committed May 1, 2019
1 parent 5ee341c commit 5b8b9c0
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/Perl6/Metamodel/RoleToClassApplier.nqp
Expand Up @@ -102,11 +102,11 @@ my class RoleToClassApplier {
my @stubs; my @stubs;


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

0 comments on commit 5b8b9c0

Please sign in to comment.