switch force_backtrack to execute a backtrack step
Matt S Trout [Thu, 23 Jun 2016 17:30:06 +0000 (17:30 +0000)]
lib/DX/SearchState.pm

index 18979e7..dcfb606 100644 (file)
@@ -44,12 +44,9 @@ sub force_backtrack {
   my ($first_alt, @rest_alt) = @{$self->alternatives};
   return undef unless $first_alt;
   trace 'search.backtrack.forced' => $first_alt->[0];
-  return ref($self)->new(
-    current_hypothesis => $first_alt->[0],
-    next_step => $first_alt->[1],
-    alternatives => \@rest_alt,
-    propositions => $self->propositions,
-  );
+  return $self->but(
+    next_step => DX::Step::Backtrack->new,
+  )->with_one_step;
 }
 
 1;