predicates => {
'eq' => use_module('DX::Predicate::Eq')->new,
member_at => use_module('DX::Predicate::MemberAt')->new,
- is_dict => use_module('DX::Predicate::IsDict')->new,
+ dict => use_module('DX::Predicate::Dict')->new,
},
globals => dict(),
proposition_sequence
-package DX::Predicate::IsDict;
+package DX::Predicate::Dict;
use DX::Utils qw(step dict TYPE_OF);
use DX::Class;
with 'DX::Role::Predicate';
sub _possible_resolution_list {
- my ($self, $arg) = @_;
+ my ($self, $arg, $proto) = @_;
if ($arg->is_set) {
- die "is_dict called with non-dict"
+ die "dict called with non-dict"
unless $arg->isa('DX::Value::Dict');
return step(
actions => [],
depends_on => [ [ undef ,=> [ TYPE_OF ,=> $arg ] ] ]
);
}
- my $set = $arg->action_for_set_value(dict());
+ if ($proto and not $proto->isa('DX::Value::Dict')) {
+ die "dict called with non-dict prototype";
+ }
+ my $set = $arg->action_for_set_value($proto||dict());
return step(
actions => [ $set ],
depends_on => [ [ undef ,=> [ TYPE_OF ,=> $arg ] ] ]