X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDX%2FRole%2FPredicate.pm;h=a8e86a60708c90dd472eb941e5b4e1afd31de618;hb=29daa5541fda849f06b7bf5ecd2d4a72f263b184;hp=c1bcc0bd5b8fa322a6117421fdd1010b9cc9259b;hpb=0498469a8299e06cc983edb90de11d5f352ab369;p=scpubgit%2FDX.git diff --git a/lib/DX/Role/Predicate.pm b/lib/DX/Role/Predicate.pm index c1bcc0b..a8e86a6 100644 --- a/lib/DX/Role/Predicate.pm +++ b/lib/DX/Role/Predicate.pm @@ -1,61 +1,12 @@ package DX::Role::Predicate; -use List::Util qw(reduce); -use DX::Utils qw(step); 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 => [ $left, $right ], - ); - } - return ( - do { - if ($left->is_set and my $set = $right->action_for_set_value($left)) { - step( - actions => [ $set ], - depends_on => [ - [ $right => - [ $left ], [ $right ] - ] - ] - ) - } else { - () - } - }, - do { - if ($right->is_set and my $set = $left->action_for_set_value($right)) { - step( - actions => [ $set ], - depends_on => [ - [ $left => - [ $left ], [ $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;