package DX::Predicate::MemberAt;
-use DX::Utils qw(step INDICES_OF EXISTENCE_OF);
+use DX::Utils qw(step INDICES_OF EXISTENCE_OF CONTENTS_OF);
use DX::Class;
with 'DX::Role::Predicate';
return (
($key->is_set
? map $_->but_with_dependencies_on(
- [ undef ,=> [ $coll, EXISTENCE_OF ,=> $key ], $key ]
+ [ undef ,=>
+ [ EXISTENCE_OF ,=> $coll, $key->string_value ],
+ [ CONTENTS_OF ,=> $key ],
+ ]
), do {
if (my $cur_val = $coll->get_member_at($key)) {
$self->_make_equal($cur_val, $value);
} elsif (
$value->is_set
- and my $add = $coll->action_for_add_value($key, $value)
+ and my $add = $coll->action_for_add_member($key, $value)
) {
step(
actions => [ $add ],
depends_on => [
- [ $coll => [ $coll, $key ], $value ]
+ [ $value =>
+ [ CONTENTS_OF ,=> $coll, $key->string_value ],
+ [ CONTENTS_OF ,=> $value ],
+ ],
],
);
} else {
my $set_key = $key->action_for_set_value($_);
map $_->but_first($set_key)
->but_with_dependencies_on(
- [ undef ,=> [ $coll, EXISTENCE_OF ,=> $key ] ]
+ [ undef ,=>
+ [ EXISTENCE_OF ,=> $coll, $key->string_value ]
+ ]
),
$self->_make_equal($coll->get_member_at($_), $value);
} $coll->index_list
sub selection_depends_on {
my ($self, $coll, $key, $value) = @_;
+ die "NEEDS REDOING";
[ [ $coll => ($key->can_set_value ? INDICES_OF : (EXISTENCE_OF ,=> $key)) ],
$key,
$value,