+++ /dev/null
-package DX::Op::MemberLookup;
-
-use Moo;
-
-with 'DX::Role::Op';
-
-has member_var => (is => 'ro', required => 1);
-has coll_name => (is => 'ro', required => 1);
-has key_name => (is => 'ro', required => 1);
-has key_var => (is => 'ro', required => 1);
-
-sub run {
- my ($self, $state) = @_;
- my ($member, $key) = map $state->scope_var($self->$_), qw(member_var key_var);
- die "key unbound" unless $key->is_bound;
- die "member bound" if $member->is_bound;
- my $set = $state->facts->{$self->coll_name};
- if (my $value = $set->{$key->bound_value}) {
- return $state->bind_var_then($member, $value, $self->next);
- }
- return $state->backtrack;
-}
-
-1;
use Moo;
use DX::Op::CallRule;
use DX::Op::MemberOf;
-use DX::Op::MemberLookup;
use DX::Op::ApplyConstraint;
use DX::Op::Return;
use List::Util qw(reduce);
);
}
-sub _expand_member_lookup {
- my ($self, $member_var, $coll_name, $key_name, $key_var) = @_;
- DX::Op::MemberLookup->new(
- member_var => $member_var,
- coll_name => $coll_name,
- key_name => $key_name,
- key_var => $key_var
- );
-}
-
sub _expand_constrain {
my ($self, $vars, $constraint) = @_;
DX::Op::ApplyConstraint->new(