From: Matt S Trout Date: Fri, 14 Feb 2014 19:54:10 +0000 (+0000) Subject: make MemberOf handle a bound RHS X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=db920199afa56ad9309481bad5d1b89866b0ef65;p=scpubgit%2FDKit.git make MemberOf handle a bound RHS --- diff --git a/lib/DX/Op/MemberOf.pm b/lib/DX/Op/MemberOf.pm index 65f4511..cb9239d 100644 --- a/lib/DX/Op/MemberOf.pm +++ b/lib/DX/Op/MemberOf.pm @@ -16,10 +16,21 @@ sub run { of => $self->coll_var ); my ($member, $of) = @args{qw(member of)}; - die "member bound" if $member->is_bound; - my $set = $state->facts->{my $type = $state->resolve_value($of)}; - my $ref_set = DX::RefSet->new( - target => $type, names => [ $set->key_list ], + my $type = $state->resolve_value($of); + my $set = ref($type) ? $type : $state->facts->{$type}; + if ($member->is_bound) { + my $test = $state->resolve_value($member); + if (grep { $_ eq $test } $set->all) { + return $state->then($self->next); + } + return $state->backtrack; + } + my $ref_set = ( + ref($type) + ? $set + : DX::RefSet->new( + target => $type, names => [ $set->key_list ], + ) ); return $state->then($self->next) ->add_dependencies($member->id, $of->id)