use DX::Step::EnterRecheck;
use DX::Step::Backtrack;
-use Types::Standard qw(ArrayRef);
+use DX::Utils qw(expand_deps);
use DX::Class;
with 'DX::Role::Step';
-has resolves => (is => 'lazy', init_arg => undef, builder => sub {
- my ($self) = @_;
- $self->resolution_space->proposition;
-});
-
has resolution_space => (is => 'ro', isa => ResolutionSpace);
-has current_resolution => (is => 'lazy', init_arg => undef, builder => sub {
- my ($self) = @_;
- $self->resolution_space->next_resolution;
-});
-
-has actions => (is => 'lazy', init_arg => undef, builder => sub {
- my ($self) = @_;
- $self->current_resolution->actions;
-});
-
-has depends_on => (is => 'lazy', init_arg => undef, builder => sub {
- my ($self) = @_;
- my $_expand_dep = sub {
- my ($type, @path) = @{$_[0]};
- my @expanded = map {
- ref() ? @{$_->value_path or return ()} : $_
- } @path;
- return [ $type, @expanded ];
- };
- [ map $_expand_dep->($_),
- @{$self->current_resolution->veracity_depends_on} ];
-});
+sub resolves { shift->resolution_space->proposition }
+
+sub current_resolution { shift->resolution_space->next_resolution }
+
+sub actions { shift->current_resolution->actions }
-has alternative_step => (is => 'lazy', init_arg => undef, builder => sub {
- my ($self) = @_;
- my $rspace = $self->resolution_space->remaining_resolution_space;
- return undef unless @{$rspace->members};
- return $rspace->next_step;
-});
+sub depends_on { shift->current_resolution->veracity_depends_on }
sub but_first {
my ($self, @actions) = @_;
(@{$self->actions}
? [ statement => [
[ symbol => 'actions' ],
- [ block => [ @{$self->actions} ] ],
+ [ block => $self->actions ],
] ]
: ()),
[ statement => [
[ symbol => 'depends_on' ],
- [ pairs => [
- map [
- (split '::', ${$_->[0]})[-1],
+ [ block => [
+ map [ statement => [
+ [ symbol => (split '::', ${$_->[0]})[-1] ],
[ value_path => [ @{$_}[1..$#$_] ] ]
- ], @{$self->depends_on}
+ ] ], @{$self->depends_on}
] ],
] ],
] ]