switch adjustments to keep search state to preserve on_X_step values
[scpubgit/DX.git] / lib / DX / Step / Backtrack.pm
index f211c73..f145351 100644 (file)
@@ -6,15 +6,9 @@ with 'DX::Role::Step';
 
 sub apply_to {
   my ($self, $ss) = @_;
-  my ($first_alt, @rest_alt) = @{$ss->alternatives};
+  my ($first_alt, @rest_alt) = @{$ss->adjustments_made};
   return $ss->but(next_step => $ss->on_exhaustion_step) unless $first_alt;
-  trace 'search.backtrack.rewind_to' => $first_alt->[1];
-  return $ss->but(
-    current_hypothesis => $first_alt->[0],
-    alternatives => \@rest_alt,
-    next_step => $first_alt->[1],
-    is_solution_step => 0,
-  );
+  return $first_alt->[1]->but(next_step => $first_alt->[0]->alternative_step);
 }
 
 1;