From: Matt S Trout Date: Tue, 11 Feb 2014 07:23:25 +0000 (+0000) Subject: remove the _then bind methods X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7a0670cd4e8498fff81f07ec1686ff5d0c899f64;p=scpubgit%2FDKit.git remove the _then bind methods --- diff --git a/lib/DX/Op/MemberOf.pm b/lib/DX/Op/MemberOf.pm index 4493620..e5e9ca4 100644 --- a/lib/DX/Op/MemberOf.pm +++ b/lib/DX/Op/MemberOf.pm @@ -17,8 +17,9 @@ sub run { my ($member, $of) = @args{qw(member of)}; die "member bound" if $member->is_bound; my $set = $state->facts->{$of->bound_value}; - return $state->bind_root_set_then($member->id, $set, $self->next) - ->add_dependencies($member->id, $of->id); + return $state->then($self->next) + ->add_dependencies($member->id, $of->id) + ->bind_root_set($member->id, $set) } 1; diff --git a/lib/DX/State.pm b/lib/DX/State.pm index 051d0d2..c677ce0 100644 --- a/lib/DX/State.pm +++ b/lib/DX/State.pm @@ -67,21 +67,19 @@ sub bind_value { ); } -sub bind_stream_then { - my ($self, $var, $stream, $then) = @_; +sub bind_stream { + my ($self, $var, $stream) = @_; my $bound = $var->with_stream($stream); $self->but( by_id => { %{$self->by_id}, $var->id => $bound }, - next_op => $then )->mark_choice($bound); } -sub bind_root_set_then { - my ($self, $var_id, $set, $then) = @_; +sub bind_root_set { + my ($self, $var_id, $set) = @_; my $bound = $self->by_id->{$var_id}->with_root_set($set); $self->but( by_id => { %{$self->by_id}, $var_id => $bound }, - next_op => $then )->mark_choice($bound); } diff --git a/t/basic.t b/t/basic.t index aba5c58..8612ea7 100644 --- a/t/basic.t +++ b/t/basic.t @@ -28,10 +28,9 @@ sub bind_array { my ($var, $array) = @_; sub { my ($self, $state) = @_; - $state->bind_stream_then( + $state->then($self->next)->bind_stream( $state->scope_var($var), ArrayStream->from_array(@$array), - $self->next ) } }