move invoke predicate logic into normal step
Matt S Trout [Mon, 20 Jun 2016 00:38:33 +0000 (00:38 +0000)]
lib/DX/SearchState.pm
lib/DX/Step/Normal.pm

index b1b4038..005aa3c 100644 (file)
@@ -45,9 +45,6 @@ sub with_one_step {
           : ()),
         @{$new_ss->alternatives}
       ],
-      next_step => DX::Step::InvokeNextPredicate->new(
-        proposition => $new_ss->next_proposition,
-      ),
     );
   }
   if ($alt_step) {
index 350d4dc..10c4eb9 100644 (file)
@@ -32,7 +32,16 @@ sub apply_to {
   my $new_hyp = $self->_apply_to_hyp($old_hyp);
   return (undef, $self->alternative_step) unless $new_hyp;
   trace 'step.apply.new_hyp '.$self => $new_hyp;
-  return ($ss->but(current_hypothesis => $new_hyp), $self->alternative_step);
+  my $ns = DX::Step::InvokeNextPredicate->new(
+    proposition => $ss->next_proposition($new_hyp)
+  );
+  return (
+    $ss->but(
+      current_hypothesis => $new_hyp,
+      next_step => $ns,
+    ),
+    $self->alternative_step
+  );
 }
 
 sub _apply_to_hyp {