From: Matt S Trout Date: Sun, 26 Jun 2016 17:48:45 +0000 (+0000) Subject: have with_actions return the recheck list X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ea0dbc2aca498af5fcfbe6621a5547897c487340;p=scpubgit%2FDX.git have with_actions return the recheck list --- diff --git a/lib/DX/Hypothesis.pm b/lib/DX/Hypothesis.pm index 5e9a147..931cd0c 100644 --- a/lib/DX/Hypothesis.pm +++ b/lib/DX/Hypothesis.pm @@ -31,15 +31,16 @@ sub with_actions { return undef unless $hyp; push @events, @these_events; } - $hyp = $hyp->but_recheck_for(@events); - return $hyp; + my ($still_resolved, @recheck) = $hyp->resolved_propositions + ->but_expire_for(@events); + return ( + $hyp->but(resolved_propositions => $still_resolved), + @recheck + ); } sub but_recheck_for { - my ($self, @events) = @_; - my ($still_resolved, @recheck) = $self->resolved_propositions - ->but_expire_for(@events); - return $self unless @recheck; + my ($self, @recheck) = @_; my $ap = DX::ActionPolicy::LockScope->new( lock_to_depth => $self->scope->depth, @@ -76,7 +77,7 @@ sub but_recheck_for { my $sol_rps = $sol_ss->current_hypothesis->resolved_propositions; - my $rps = $still_resolved; + my $rps = $self->resolved_propositions; $rps = $rps->with_updated_dependencies_for( $_, $sol_rps->dependencies_for($_) @@ -89,8 +90,12 @@ sub but_recheck_for { sub with_resolution { my ($self, $prop, $depends, $actions) = @_; - my $hyp = $self->with_actions(@$actions); + (my $hyp, my @recheck) = $self->with_actions(@$actions); return undef unless $hyp; + if (@recheck) { + $hyp = $hyp->but_recheck_for(@recheck); + return undef unless $hyp; + } $hyp->but( resolved_propositions => $self->resolved_propositions ->with_resolution_for(