From: Matt S Trout Date: Sat, 22 Feb 2014 06:07:44 +0000 (+0000) Subject: expunge exists entirely X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1ca2da5edfd6c5719f486c88a5997ec9cd9e5b88;p=scpubgit%2FDKit.git expunge exists entirely --- diff --git a/lib/DX/Lib/FS.pm b/lib/DX/Lib/FS.pm index de452bc..c2be166 100644 --- a/lib/DX/Lib/FS.pm +++ b/lib/DX/Lib/FS.pm @@ -31,17 +31,15 @@ our @RULES = ( [ _path_status_at => qw(PS P) ] ], [ ps_prop => [ 'P', 'Name', 'Value' ], - [ exists => [ 'PS' ], - [ path_status_at => qw(PS P) ], - [ prop => qw(PS Name Value) ] ] ], + [ path_status_at => qw(PS P) ], + [ prop => qw(PS Name Value) ] ], [ ps_info_prop => [ 'P', 'Name', 'Value' ], - [ exists => [ 'PSI' ], - [ ps_prop => 'P', \'info', 'PSI' ], - [ prop => 'PSI', 'Name', 'Value' ] ] ], + [ ps_prop => 'P', \'info', 'PSI' ], + [ prop => 'PSI', 'Name', 'Value' ] ], [ exists_path => [ qw(P) ], - [ exists => [ qw(PSI) ], [ ps_prop => 'P' => \'info' => 'PSI' ] ] ], + [ ps_prop => 'P' => \'info' => 'PSI' ] ], [ _is_directory => [ qw(P) ], [ ps_info_prop => 'P' => \'is_directory' => \1 ] ], @@ -86,24 +84,22 @@ our @RULES = ( [ does => 'A', \'DX::Lib::FS::Action::CreateFile' ] ], [ mode => [ qw(P M) ], - [ exists => [ qw(PS A) ], - [ path_status_at => qw(PS P) ], - [ has_action => qw(PS A) ], - [ _action_is_creating => 'A' ], - [ react => [ qw(PS M) ], sub { - $_[0]->but(mode => $_[1]); - } ] ], + [ path_status_at => qw(PS P) ], + [ has_action => qw(PS A) ], + [ _action_is_creating => 'A' ], + [ react => [ qw(PS M) ], sub { + $_[0]->but(mode => $_[1]); + } ], [ 'cut' ] ], [ mode => [ qw(P M) ], - [ exists => [ qw(PS) ], - [ path_status_at => qw(PS P) ], - [ not => [ _mode => qw(P M) ] ], - [ act => [ qw(PS M) ], sub { - DX::Lib::FS::Action::SetPathMode->new( - path_status => $_[0], mode => $_[1] - ) - } ] ], + [ path_status_at => qw(PS P) ], + [ not => [ _mode => qw(P M) ] ], + [ act => [ qw(PS M) ], sub { + DX::Lib::FS::Action::SetPathMode->new( + path_status => $_[0], mode => $_[1] + ) + } ], [ 'cut' ] ], [ file_content => [ qw(FC) ], @@ -127,17 +123,15 @@ our @RULES = ( [ _file_content_at => qw(FC P) ] ], [ fc_prop => [ qw(P Name Value) ], - [ exists => [ 'FC' ], - [ file_content_at => qw(FC P) ], - [ prop => qw(FC Name Value) ] ] ], + [ file_content_at => qw(FC P) ], + [ prop => qw(FC Name Value) ] ], [ file_data => [ qw(P D) ], [ fc_prop => 'P', \'data', 'D' ] ], [ _contains_line => [ qw(P L) ], [ is_file => 'P' ], - [ exists => [ 'Lines' ], - [ fc_prop => 'P', \'lines', 'Lines' ], - [ member_of => qw(L Lines) ] ] ], + [ fc_prop => 'P', \'lines', 'Lines' ], + [ member_of => qw(L Lines) ] ], [ contains_line => [ qw(P L) ], [ _contains_line => qw(P L) ] ], @@ -150,32 +144,29 @@ our @RULES = ( [ contains_line => [ qw(P L) ], [ not => [ _contains_line => qw(P L) ] ], - [ exists => [ qw(FC A) ], - [ file_content_at => qw(FC P) ], - [ has_action => qw(FC A) ], - [ _action_modifying_fc => 'A' ], - [ react => [ qw(FC L) ], sub { - $_[0]->but_add($_[1]) - } ] ], + [ file_content_at => qw(FC P) ], + [ has_action => qw(FC A) ], + [ _action_modifying_fc => 'A' ], + [ react => [ qw(FC L) ], sub { + $_[0]->but_add($_[1]) + } ], [ 'cut' ] ], [ contains_line => [ qw(P L) ], [ not => [ _contains_line => qw(P L) ] ], - [ exists => [ qw(FC) ], - [ file_content_at => qw(FC P) ], - [ act => [ qw(FC L) ], sub { - DX::Lib::FS::Action::RewriteFile->new( - from => $_[0], - )->but_add($_[1]) - } ] ] ], + [ file_content_at => qw(FC P) ], + [ act => [ qw(FC L) ], sub { + DX::Lib::FS::Action::RewriteFile->new( + from => $_[0], + )->but_add($_[1]) + } ] ], [ not_contains_line => [ qw(P L) ], [ not => [ _contains_line => qw(P L) ] ] ], [ _arrange_removal_of => [ qw(FC L) ], - [ exists => [ 'A' ], - [ has_action => qw(FC A) ], - [ does => 'A' => \'DX::Lib::FS::Action::RewriteFile' ] ], + [ has_action => qw(FC A) ], + [ does => 'A' => \'DX::Lib::FS::Action::RewriteFile' ], [ react => [ qw(FC L) ], sub { $_[0]->but_remove($_[1]) } ] ], [ _arrange_removal_of => [ qw(FC L) ], @@ -187,10 +178,8 @@ our @RULES = ( [ not_contains_line => [ qw(P L) ], [ _contains_line => qw(P L) ], - [ exists => [ qw(FC) ], - [ file_content_at => qw(FC P) ], - [ _arrange_removal_of => qw(FC L) ], - ], + [ file_content_at => qw(FC P) ], + [ _arrange_removal_of => qw(FC L) ], [ 'cut' ] ], [ file_in => [ qw(DirPath FileName FilePath) ], diff --git a/lib/DX/Op/Exists.pm b/lib/DX/Op/Exists.pm deleted file mode 100644 index a7758dd..0000000 --- a/lib/DX/Op/Exists.pm +++ /dev/null @@ -1,21 +0,0 @@ -package DX::Op::Exists; - -use DX::Op::SetScope; -use Moo; - -has vars => (is => 'ro', required => 1); -has body => (is => 'ro', required => 1); - -with 'DX::Role::Op'; - -sub run { - my ($self, $state) = @_; - my $ret_op = DX::Op::SetScope->new( - scope => $state->scope, - next => $self->next - ); - $state->assign_vars(map +($_ => {}), @{$self->vars}) - ->push_return_then($ret_op, $self->body); -} - -1; diff --git a/lib/DX/RuleSet.pm b/lib/DX/RuleSet.pm index f0ee6ed..0fada41 100644 --- a/lib/DX/RuleSet.pm +++ b/lib/DX/RuleSet.pm @@ -14,7 +14,6 @@ use DX::Op::ProposeAction; use DX::Op::ModifyAction; use DX::Op::Materialize; use DX::Op::Prop; -use DX::Op::Exists; use DX::Op::Predicate; use DX::Op::HasAction; use DX::Op::FindAll; @@ -149,14 +148,6 @@ sub _expand_op_prop { DX::Op::Prop->new(%new); } -sub _expand_op_exists { - my ($self, $vars, @body) = @_; - DX::Op::Exists->new( - vars => $vars, - body => $self->expand_and_link(DX::Op::Return->new, @body) - ); -} - sub _expand_op_has_action { my ($self, @args) = @_; DX::Op::HasAction->new(arg_spec => \@args);