Skip to content

Commit

Permalink
Use is built instead of BUILD submethod
Browse files Browse the repository at this point in the history
  • Loading branch information
Leont committed Aug 13, 2022
1 parent f52b256 commit 61817f1
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions lib/TAP.pm
Expand Up @@ -812,13 +812,9 @@ class Source::Supply does Source {

class Async {
has Str $.name;
has Run $!run handles <kill events>;
has State $!state;
has Promise $.waiter;

submethod BUILD(Str :$!name, State :$!state, Run :$!run) {
$!waiter = Promise.allof($!state.done, $!run.process);
}
has Run $!run handles <kill events> is built;
has State $!state is built;
has Promise $.waiter is built(False) = Promise.allof($!state.done, $!run.process);

multi get_runner(Source::Proc $proc) {
my $async = Proc::Async.new($proc.path, $proc.args);
Expand Down Expand Up @@ -947,10 +943,8 @@ class Harness {
has Bool $.color;

class Run does Awaitable {
has Promise $!waiter handles <result>;
has Promise $!bailout;
submethod BUILD (Promise :$!waiter, Promise :$!bailout) {
}
has Promise $!waiter handles <result> is built;
has Promise $!bailout is built;
method kill(Any:D $reason) {
$!bailout.break($reason);
}
Expand Down

0 comments on commit 61817f1

Please sign in to comment.