From: Matt S Trout Date: Fri, 15 Jul 2016 20:54:51 +0000 (+0000) Subject: cleanup resolveprop apply_to logic a bit X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=389ebbbb0f839b81664c437dec34cf6e46d40fe8;p=scpubgit%2FDX.git cleanup resolveprop apply_to logic a bit --- diff --git a/lib/DX/Step/ResolveProposition.pm b/lib/DX/Step/ResolveProposition.pm index d92ac24..66a980d 100644 --- a/lib/DX/Step/ResolveProposition.pm +++ b/lib/DX/Step/ResolveProposition.pm @@ -26,29 +26,29 @@ sub but_with_dependencies_on { sub apply_to { my ($self, $ss) = @_; - my $old_hyp = $ss->current_hypothesis; - trace 'step.apply.old_hyp '.$self => $old_hyp; + trace 'step.apply.old_hyp '.$self => $ss->current_hypothesis; trace 'step.apply.actions '.$self => $self->actions; my $new_ss = $self->_apply_to_ss($ss); return $ss->but(next_step => DX::Step::Backtrack->new) unless $new_ss; - my $new_hyp = $new_ss->current_hypothesis; - trace 'step.apply.new_hyp '.$self => $new_hyp; + trace 'step.apply.new_hyp '.$self => $new_ss->current_hypothesis; my $ns = do { - if (my $prop = $ss->next_proposition($new_hyp)) { + if (my $prop = $new_ss->next_proposition) { DX::Step::ConsiderProposition->new( proposition => $prop ) } else { - $ss->on_solution_step + $new_ss->on_solution_step } }; my $alt_step = $self->alternative_step; return ( - $ss->but( - current_hypothesis => $new_hyp, + $new_ss->but( next_step => $ns, ($alt_step - ? (alternatives => [ [ $old_hyp, $alt_step ], @{$ss->alternatives} ]) + ? (alternatives => [ + [ $ss->current_hypothesis, $alt_step ], + @{$ss->alternatives} + ]) : () ), ),