1 package DX::Op::FindAll;
4 use DX::Op::FindAllCollect;
12 has coll_name => (is => 'ro', required => 1);
14 has var_name => (is => 'ro', required => 1);
16 has body => (is => 'ro', required => 1);
19 my ($self, $state) = @_;
21 my $coll = DX::OrderedSet->new(values => $values);
22 my $collect = DX::Op::FindAllCollect->new(
23 var_name => $self->var_name,
26 my $do_body = DX::Op::FromCode->new(
28 my ($self, $state) = @_;
29 $state->push_return_then($collect, $self->next);
33 my $var = DX::Var->new(id => "rule:findall")
34 ->with_stream(DX::ArrayStream->from_array(
35 $do_body, DX::Op::Return->new
37 my $invoke = DX::Op::FromCode->new(
39 my ($self, $state) = @_;
40 my $op = $state->resolve_value($var);
44 my $coll_name = $self->coll_name;
45 my $ret = DX::Op::SetScope->new(
46 scope => $state->scope,
47 next => DX::Op::FromCode->new(
49 my ($self, $state) = @_;
50 $state->bind_value($state->scope->{$coll_name} => $coll)
56 $state->assign_vars($self->var_name => {})
57 ->push_return_then($ret, $invoke)->mark_choice($var);