Skip to content
Permalink
Browse files

Implement Code.cando

- which is a very simple smartmatch of the signature with the capture
- the Routine.cando one is much more complex as it support multi dispatch
- fixes R#2420
- also make sure Routine.cando only takes instantiated captures
  • Loading branch information...
lizmat committed Oct 24, 2018
1 parent 65d4fd7 commit 45eeab7876b34c43b5249129d725830e43da4ce1
Showing with 2 additions and 1 deletion.
  1. +1 −0 src/core/Code.pm6
  2. +1 −1 src/core/Routine.pm6
@@ -13,6 +13,7 @@ my class Code does Callable { # declared in BOOTSTRAP
method count(Code:D:) { nqp::getattr($!signature,Signature,'$!count') }

method signature(Code:D:) { $!signature }
method cando(Capture:D $c) { $!signature.ACCEPTS($c) }

proto method prec(|) {*}
multi method prec() { my % }
@@ -28,7 +28,7 @@ my class Routine { # declared in BOOTSTRAP
(self,)
}

method cando(Capture $c) {
method cando(Capture:D $c) {
my $disp;
if self.is_dispatcher {
$disp := self;

0 comments on commit 45eeab7

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