From: Matt S Trout Date: Mon, 3 Feb 2014 00:20:48 +0000 (+0000) Subject: remove member lookup op X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8e191e76952a1fa56c7e3eef70d41f19beb41b1b;p=scpubgit%2FDKit.git remove member lookup op --- diff --git a/lib/DX/Op/MemberLookup.pm b/lib/DX/Op/MemberLookup.pm deleted file mode 100644 index 51827f2..0000000 --- a/lib/DX/Op/MemberLookup.pm +++ /dev/null @@ -1,24 +0,0 @@ -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; diff --git a/lib/DX/RuleSet.pm b/lib/DX/RuleSet.pm index 328eb85..b051306 100644 --- a/lib/DX/RuleSet.pm +++ b/lib/DX/RuleSet.pm @@ -3,7 +3,6 @@ package DX::RuleSet; 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); @@ -46,16 +45,6 @@ sub _expand_member_of { ); } -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(