Skip to content

Commit

Permalink
Implement FALLBACK.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Dec 15, 2014
1 parent d6d08d5 commit 251989b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Perl6/Metamodel/ClassHOW.nqp
Expand Up @@ -144,6 +144,15 @@ class Perl6::Metamodel::ClassHOW
}
}

# If there's a FALLBACK method, register something to forward calls to it.
if self.find_method($obj, 'FALLBACK', :no_fallback) -> $FALLBACK {
self.add_fallback($obj,
sub ($obj, $name) { 1 },
sub ($obj, $name) {
-> $inv, *@pos, *%named { $FALLBACK($inv, $name, |@pos, |%named) }
});
}

# Publish type and method caches.
self.publish_type_cache($obj);
self.publish_method_cache($obj);
Expand Down

0 comments on commit 251989b

Please sign in to comment.