Mercurial > hg > Others > Rakudo
view src/core.c/WalkList.pm6 @ 0:c341f82e7ad7 default tip
Rakudo branch in cr.ie.u-ryukyu.ac.jp
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 26 Dec 2019 16:50:27 +0900 |
parents | |
children |
line wrap: on
line source
# This is what Mu::WALK method returns. my class WalkList is List { has Mu $.invocant; has $.quiet = False; method new(|) { callsame.quiet(False) } proto method invoke(|) {*} multi method invoke(::?CLASS:D: Capture:D $args) { my @rv; for |self -> &method { my $val = $!invocant.&method(|$args); @rv.push: $val ~~ Slip ?? $val.List !! $val; CATCH { default { $_.throw unless $!quiet; @rv.push: Failure.new($_) } } } @rv } multi method invoke(::?CLASS:D: |c) { note "invoke(", c.perl, ")" if %*ENV<RAKUDO_DEBUG>; samewith(c) } method quiet(::?CLASS:D: Bool() $quiet = True --> ::?CLASS:D) { $!quiet = $quiet; self } method reverse(::?CLASS:D: --> ::?CLASS:D) { self.WHAT.new(|self.List::reverse) .set_invocant($!invocant) .quiet($!quiet) } method set_invocant(::?CLASS:D: Mu \inv) { $!invocant = inv; self } method CALL-ME(::?CLASS:D: |c) { self.invoke(c) } }