move dep expansion into predicates for the moment
[scpubgit/DX.git] / lib / DX / Predicate / Dict.pm
CommitLineData
9fd6087b 1package DX::Predicate::Dict;
efad53c4 2
fe5af11f 3use DX::Utils qw(rspace res dict TYPE_OF expand_deps);
efad53c4 4use DX::Class;
5
6with 'DX::Role::Predicate';
7
feceff29 8sub _resolution_space_for {
9fd6087b 9 my ($self, $arg, $proto) = @_;
feceff29 10
11 die "dict called with non-dict"
12 if $arg->is_set and not $arg->isa('DX::Value::Dict');
13
14 die "dict called with non-dict prototype"
15 if $proto and not $proto->isa('DX::Value::Dict');
16
fe5af11f 17 my $deps = expand_deps([ [ TYPE_OF ,=> $arg ] ]);
feceff29 18
19 my $actions =
20 $arg->is_set ? [] : [ $arg->action_for_set_value($proto||dict()) ];
21
22 return rspace(
23 geometry_depends_on => $deps,
6aa36401 24 aperture => $arg->aperture_for_set_value,
feceff29 25 members => [ res(
26 actions => $actions,
27 veracity_depends_on => $deps
28 ) ],
efad53c4 29 );
30}
31
321;