add propositions method to searchstate
[scpubgit/DX.git] / lib / DX / SearchState.pm
index 38271b3..def236d 100644 (file)
@@ -8,18 +8,21 @@ has current_hypothesis => (is => 'ro', isa => Hypothesis, required => 1);
 
 has next_step => (is => 'ro', isa => Maybe[Step]);
 
+has propositions => (is => 'ro', isa => PropositionSequence, required => 1);
+
 has alternatives => (is => 'ro', isa => AlternativeList, required => 1);
 
 sub next_proposition { $_[0]->current_hypothesis->head_proposition }
 
 sub new_for {
-  my ($class, $hyp) = @_;
+  my ($class, $hyp, $props) = @_;
   $class->new(
     current_hypothesis => $hyp,
     alternatives => [],
     next_step => DX::Step::InvokeNextPredicate->new(
       proposition => $hyp->head_proposition,
     ),
+    propositions => $props,
   );
 }
 
@@ -72,7 +75,8 @@ sub force_backtrack {
   return ref($self)->new(
     current_hypothesis => $first_alt->[0],
     next_step => $first_alt->[1],
-    alternatives => \@rest_alt
+    alternatives => \@rest_alt,
+    propositions => $self->propositions,
   );
 }