introduce next_step method to rspace
[scpubgit/DX.git] / lib / DX / Role / Predicate.pm
index 2a94ade..0612168 100644 (file)
@@ -5,59 +5,10 @@ use DX::Utils qw(step CONTENTS_OF);
 use DX::Role;
 
 sub resolution_step_for {
-  my ($self, @args) = @_;
-  my ($last, @rest) = reverse $self->_possible_resolution_list(@args);
-  return undef unless $last;
-  my $targ = $last;
-  $targ = $_->but_with_alternative_step($targ) for @rest;
-  return $targ;
-}
-
-sub _make_equal {
-  my ($self, $left, $right) = @_;
-  if ($left->equals($right)) {
-    return step(
-      actions => [],
-      depends_on => [
-        [ undef ,=> [ CONTENTS_OF ,=> $left ], [ CONTENTS_OF ,=> $right ] ]
-      ],
-    );
-  }
-  return (
-    do {
-      if ($left->is_set and my $set = $right->action_for_set_value($left)) {
-        step(
-          actions => [ $set ],
-          depends_on => [
-            [ $right =>
-              [ CONTENTS_OF ,=> $left ], [ CONTENTS_OF ,=> $right ]
-            ]
-          ]
-        )
-      } else {
-        ()
-      }
-    },
-    do {
-      if ($right->is_set and my $set = $left->action_for_set_value($right)) {
-        step(
-          actions => [ $set ],
-          depends_on => [
-            [ $left =>
-              [ CONTENTS_OF ,=> $left ], [ CONTENTS_OF ,=> $right ]
-            ]
-          ]
-        )
-      } else {
-        ()
-      }
-    },
-  );
-}
-
-sub selection_depends_on {
-  my ($self, @args) = @_;
-  \@args;
+  my ($self, $prop, @args) = @_;
+  $self->_resolution_space_for(@args)
+       ->but(proposition => $prop)
+       ->next_step;
 }
 
 1;