extract backtrack decisions out into steps
[scpubgit/DX.git] / lib / DX / SearchState.pm
index 99ac3f2..18979e7 100644 (file)
@@ -35,16 +35,8 @@ sub new_for {
 
 sub with_one_step {
   my ($self) = @_;
-  my $hyp = $self->current_hypothesis;
   return undef unless my $step = $self->next_step;
-  my ($new_ss) = $step->apply_to($self);
-  return $new_ss if $new_ss;
-  my ($first_alt, @rest_alt) = @{$self->alternatives};
-  return undef unless $first_alt;
-  trace 'search.backtrack.rewind_to' => $first_alt->[1];
-  return $self->but(
-    next_step => DX::Step::Backtrack->new,
-  );
+  return $step->apply_to($self);
 }
 
 sub force_backtrack {