From: Matt S Trout Date: Sun, 17 Jul 2016 19:13:20 +0000 (+0000) Subject: chained rechecks X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3175309012de09cc8e1f76789a011eb11b2d8c59;p=scpubgit%2FDX.git chained rechecks --- diff --git a/lib/DX/Step/EnterRecheck.pm b/lib/DX/Step/EnterRecheck.pm index 3f5c643..7134462 100644 --- a/lib/DX/Step/EnterRecheck.pm +++ b/lib/DX/Step/EnterRecheck.pm @@ -15,8 +15,6 @@ sub apply_to { my ($prop, @rest) = @{$self->proposition_list}; - die "NOT YET DAMNIT" if @rest; - my $old_hyp = $old_ss->current_hypothesis; # we should probably be doing something about pruning the scope @@ -42,6 +40,10 @@ sub apply_to { internal_names => {}, ); + my $next_step = (@rest + ? $self->but(proposition_list => \@rest) + : $self->on_completion_step); + trace 'step.recheck.hyp' => $hyp; my $ss = DX::SearchState->new( @@ -54,9 +56,7 @@ sub apply_to { is_solution_state => 0, on_exhaustion_step => undef, on_solution_step => DX::Step::CompleteRecheck->new( - resume_search_state => $old_ss->but( - next_step => $self->on_completion_step - ), + resume_search_state => $old_ss->but(next_step => $next_step), was_recheck_for => $prop, ), ); diff --git a/lib/DX/Step/ResolveProposition.pm b/lib/DX/Step/ResolveProposition.pm index ee5ff14..95ed10d 100644 --- a/lib/DX/Step/ResolveProposition.pm +++ b/lib/DX/Step/ResolveProposition.pm @@ -73,20 +73,12 @@ sub _apply_to_ss { sub _recheck_for { my ($self, $old_ss, @recheck) = @_; - return $old_ss unless @recheck; - my $ss = $old_ss; - foreach my $prop (@recheck) { - return undef unless $ss = $self->_recheck_one($ss, $prop); - } - return $ss; -} -sub _recheck_one { - my ($self, $old_ss, $prop) = @_; + return $old_ss unless @recheck; my $ss = $old_ss->but( next_step => DX::Step::EnterRecheck->new( - proposition_list => [ $prop ], + proposition_list => \@recheck, on_completion_step => DX::Step::MarkAsSolution->new, ), );