a821f7ac86c8b23497f7c3a17095510a1828e55a
[scpubgit/DX.git] / lib / DX / Resolution.pm
1 package DX::Resolution;
2
3 use DX::Utils qw(expand_deps);
4 use DX::Class;
5
6 has veracity_depends_on => (is => 'ro', required => 1, isa => DependencyList);
7
8 has actions => (is => 'ro', required => 1, isa => ArrayRef[Action]);
9
10 sub next_resolution { $_[0] }
11
12 sub remainder { () }
13
14 sub for_deparse {
15   my ($self) = @_;
16   [ word_and_body => [
17     'resolution',
18     [ pairs => [
19       (@{$self->actions}
20         ? [ actions => [ block => $self->actions ] ]
21         : ()),
22       [ veracity_depends_on => [ block => [
23         map [ statement => [
24           [ symbol => (split '::', ${$_->[0]})[-1] ],
25           [ value_path => [ @{$_}[1..$#$_] ] ],
26         ] ], @{expand_deps($self->veracity_depends_on)}
27       ] ] ],
28     ] ],
29   ] ];
30 }
31
32 1;