X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDX%2FStep%2FResolveProposition.pm;h=c71445825546f20cf4e12227832d544559d768a8;hb=ec22d7624b97f301a3515230efe5b3a67db66d0d;hp=15ecf8633fc1d6f3276da964b869e1a87c1275d4;hpb=d6b0c811a7afc5fc2ca97f72ed1ab37b5c117e25;p=scpubgit%2FDX.git diff --git a/lib/DX/Step/ResolveProposition.pm b/lib/DX/Step/ResolveProposition.pm index 15ecf86..c714458 100644 --- a/lib/DX/Step/ResolveProposition.pm +++ b/lib/DX/Step/ResolveProposition.pm @@ -12,14 +12,6 @@ with 'DX::Role::Step'; has resolution_space => (is => 'ro', isa => ResolutionSpace); -sub resolves { shift->resolution_space->proposition } - -sub current_resolution { shift->resolution_space->next_resolution } - -sub actions { shift->current_resolution->actions } - -sub depends_on { shift->current_resolution->veracity_depends_on } - sub but_first { my ($self, @actions) = @_; $self->but(actions => [ @actions, @{$self->actions} ]); @@ -32,17 +24,21 @@ sub but_with_dependencies_on { sub apply_to { my ($self, $old_ss) = @_; + my $rspace = $self->resolution_space; + my $prop = $rspace->proposition; + my $res = $rspace->next_resolution; + my $vdeps = $res->veracity_depends_on; trace resolve => [ statement => [ [ symbol => 'resolve' ], [ block => [ [ statement => [ [ symbol => 'proposition' ], - @{$self->resolves->for_deparse->[1]}, + @{$prop->for_deparse->[1]}, ] ], - (@{$self->actions} + (@{$res->actions} ? [ statement => [ [ symbol => 'actions' ], - [ block => $self->actions ], + [ block => $res->actions ], ] ] : ()), [ statement => [ @@ -51,12 +47,11 @@ sub apply_to { map [ statement => [ [ symbol => (split '::', ${$_->[0]})[-1] ], [ value_path => [ @{$_}[1..$#$_] ] ] - ] ], @{$self->depends_on} + ] ], @{$vdeps} ] ], ] ], ] ] ] ]; - my $rspace = $self->resolution_space; my $ss = $old_ss->but( next_step => DX::Step::CompleteResolution->new( original_search_state => $old_ss, @@ -65,7 +60,7 @@ sub apply_to { ); my $old_hyp = $old_ss->current_hypothesis; (my $hyp, my @recheck) = $old_hyp->with_resolution( - $self->resolves, $self->depends_on, $self->actions + $prop, $vdeps, $res->actions ); return $ss->but(next_step => DX::Step::Backtrack->new) unless $hyp; return $ss->but(current_hypothesis => $hyp) unless @recheck;