move resolution step construction later
Matt S Trout [Mon, 16 Apr 2018 02:15:34 +0000 (02:15 +0000)]
lib/DX/Step/ResolveProposition.pm

index d1ad465..6cf99b9 100644 (file)
@@ -52,28 +52,28 @@ sub apply_to {
       ] ],
     ] ]
   ] ];
-  my $ss = $old_ss->but(
-    next_step => DX::Step::CompleteResolution->new(
-      original_search_state => $old_ss,
-      resolution_space => $rspace,
-    )
-  );
   my $old_hyp = $old_ss->current_hypothesis;
   (my $hyp, my @recheck) = $old_hyp->with_resolution(
     $prop, $vdeps, $res->actions
   );
   unless ($hyp) {
-    return $ss->but(
+    return $old_ss->but(
       next_step
         => $rspace->remaining_resolution_space->next_step
     );
   }
-  return $ss->but(current_hypothesis => $hyp) unless @recheck;
-  return $ss->but(
+  my $next_step = DX::Step::CompleteResolution->new(
+    original_search_state => $old_ss,
+    resolution_space => $rspace,
+  );
+  unless (@recheck) {
+    return $old_ss->but(next_step => $next_step, current_hypothesis => $hyp);
+  }
+  return $old_ss->but(
     current_hypothesis => $hyp,
     next_step => DX::Step::EnterRecheck->new(
       proposition_list => \@recheck,
-      on_completion_step => $ss->next_step,
+      on_completion_step => $next_step,
       resolution_space => $rspace,
     ),
   );