blow away current trace calls since they were insufficiently thought through
[scpubgit/DX.git] / lib / DX / Step / EnterRecheck.pm
index 3f5c643..2b7ac56 100644 (file)
@@ -1,6 +1,7 @@
 package DX::Step::EnterRecheck;
 
 use DX::Step::CompleteRecheck;
+use DX::Step::FailRecheck;
 
 use DX::Class;
 
@@ -10,13 +11,13 @@ has proposition_list => (is => 'ro', required => 1);
 
 has on_completion_step => (is => 'ro', required => 1);
 
+has on_failure_step => (is => 'ro', required => 1);
+
 sub apply_to {
   my ($self, $old_ss) = @_;
 
   my ($prop, @rest) = @{$self->proposition_list};
 
-  die "NOT YET DAMNIT" if @rest;
-
   my $old_hyp = $old_ss->current_hypothesis;
 
   # we should probably be doing something about pruning the scope
@@ -42,7 +43,9 @@ sub apply_to {
     internal_names => {},
   );
 
-  trace 'step.recheck.hyp' => $hyp;
+  my $next_step = (@rest
+                    ? $self->but(proposition_list => \@rest)
+                    : $self->on_completion_step);
 
   my $ss = DX::SearchState->new(
     current_hypothesis => $hyp,
@@ -52,13 +55,13 @@ sub apply_to {
                    proposition => $prop,
                  ),
     is_solution_state => 0,
-    on_exhaustion_step => undef,
     on_solution_step => DX::Step::CompleteRecheck->new(
-      resume_search_state => $old_ss->but(
-        next_step => $self->on_completion_step
-      ),
+      resume_search_state => $old_ss->but(next_step => $next_step),
       was_recheck_for => $prop,
     ),
+    on_exhaustion_step => DX::Step::FailRecheck->new(
+      resume_search_state => $old_ss->but(next_step => $self->on_failure_step),
+    ),
   );
 
   return $ss;