From: Matt S Trout Date: Fri, 4 Dec 2015 18:41:16 +0000 (+0000) Subject: operational recheck X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4016201bfc4050f0d4c2d79eab8e62f3dac99d43;p=scpubgit%2FDX.git operational recheck --- diff --git a/lib/DX/ActionBuilder/Normal.pm b/lib/DX/ActionBuilder/Normal.pm index cd5a7a0..c950758 100644 --- a/lib/DX/ActionBuilder/Normal.pm +++ b/lib/DX/ActionBuilder/Normal.pm @@ -13,6 +13,7 @@ sub action_for_set_value { DX::Action::SetValue->new( target_path => $self->target_path, new_value => $value->but_set_action_builder($self) + ->but_set_identity_path($self->target_path) ); } @@ -23,7 +24,7 @@ sub action_for_add_member { target_path => \@add_path, new_value => $value->but_set_action_builder( $self->but(target_path => \@add_path) - ) + )->but_set_identity_path(\@add_path) ); } diff --git a/lib/DX/Deparse.pm b/lib/DX/Deparse.pm index ba41df6..b94163d 100644 --- a/lib/DX/Deparse.pm +++ b/lib/DX/Deparse.pm @@ -24,6 +24,7 @@ sub fmt { sub _fmt { my ($self, $thing, $meta) = @_; + return '{}' unless defined($thing); return $thing unless ref($thing); my $type = join'_', split '::', lc +(ref($thing) =~ /^(?:DX::)?(.*)/)[0]; $self->${\"_fmt_${type}"}($thing, $meta); diff --git a/lib/DX/DependencyMap.pm b/lib/DX/DependencyMap.pm index 3a15193..22b09a0 100644 --- a/lib/DX/DependencyMap.pm +++ b/lib/DX/DependencyMap.pm @@ -23,7 +23,9 @@ sub with_entry_for { %{$self->revdeps}, $for_id => \@expanded, }; - my $new_deps = $self->_merge_deps_for($self->deps, $for_id, @expanded); + my $new_deps = $self->_merge_deps_for( + $self->deps, $for_id, map @{$_}[1..$#$_], @expanded + ); ref($self)->new( deps => $new_deps, revdeps => $new_revdeps @@ -35,7 +37,7 @@ sub without_entries_for { my %new_revdeps = %{$self->revdeps}; my $new_deps = $self->deps; $new_deps = $self->_unmerge_deps_for( - $new_deps, $_, @{$new_revdeps{$_}} + $new_deps, $_, map @{$_}[1..$#$_], @{$new_revdeps{$_}} ) for @for_ids; delete @new_revdeps{@for_ids}; ref($self)->new( @@ -77,17 +79,21 @@ sub _mangle_deps { } sub _expand_deps { - my ($self, $deps) = @_; + my ($self, $dep_groups) = @_; my @exp; - assert_DependencyGroupList $deps; - DEP: foreach my $dep (map @{$_}[1..$#$_], @$deps) { - my ($type, @path) = @$dep; - push @exp, [ - $type, - map { ref() ? @{$_->identity_path or next DEP} : $_ } @path - ]; - } - return @exp; + assert_DependencyGroupList $dep_groups; + map { + my ($on, @deps) = @$_; + my @exp; + DEP: foreach my $dep (@deps) { + my ($type, @path) = @$dep; + push @exp, [ + $type, + map { ref() ? @{$_->identity_path or next DEP} : $_ } @path + ]; + } + (@exp ? [ $on, @exp ] : ()); + } @$dep_groups; } sub _dependents_of { diff --git a/lib/DX/Hypothesis.pm b/lib/DX/Hypothesis.pm index 0cf02c6..71477e8 100644 --- a/lib/DX/Hypothesis.pm +++ b/lib/DX/Hypothesis.pm @@ -2,6 +2,7 @@ package DX::Hypothesis; use DX::ActionPolicy::LockScope; use Types::Standard qw(ArrayRef); +use DX::Utils qw(deparse); use DX::Class; has scope => (is => 'ro', isa => Scope, required => 1); diff --git a/lib/DX/ResolvedPropositionSet.pm b/lib/DX/ResolvedPropositionSet.pm index af12e5b..73d6c63 100644 --- a/lib/DX/ResolvedPropositionSet.pm +++ b/lib/DX/ResolvedPropositionSet.pm @@ -2,6 +2,7 @@ package DX::ResolvedPropositionSet; use DX::DependencyMap; use Types::Standard qw(ArrayRef); +use DX::Utils qw(deparse); use DX::Class; has dependency_map => (is => 'ro', isa => DependencyMap, required => 1); @@ -65,7 +66,7 @@ sub dependencies_for { my ($id) = grep $props[$_] eq $prop, 0..$#props; # 0 is valid, undef means the grep failed die "Unable to find $prop in proplist" unless defined $id; - return $self->dependency_map->dependencies_for($id); + return $self->dependency_map->dependencies_for($id)||[]; } 1; diff --git a/lib/DX/Step/Normal.pm b/lib/DX/Step/Normal.pm index 11890ca..e2c705e 100644 --- a/lib/DX/Step/Normal.pm +++ b/lib/DX/Step/Normal.pm @@ -1,6 +1,7 @@ package DX::Step::Normal; use Types::Standard qw(ArrayRef); +use DX::Utils qw(deparse); use DX::Class; with 'DX::Role::Step'; @@ -23,7 +24,6 @@ sub but_with_alternative_step { sub apply_to { my ($self, $old_hyp) = @_; -#::Dwarn($self->depends_on); return ($self->_apply_to_hyp($old_hyp), $self->alternative_step); } diff --git a/lib/DX/Value/Dict.pm b/lib/DX/Value/Dict.pm index 85decc7..44cc0ab 100644 --- a/lib/DX/Value/Dict.pm +++ b/lib/DX/Value/Dict.pm @@ -44,4 +44,16 @@ sub to_data { +{ map +($_ => $m->{$_}->to_data), $self->index_list }; } +sub but_set_identity_path { + my ($self, $path) = @_; + my $m = $self->members; + $self->but( + identity_path => $path, + members => +{ + map +($_ => $m->{$_}->but_set_identity_path([ @$path, $_ ])), + keys %$m + }, + ); +} + 1;