Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move FILETEST-X to Rakudo::Internals
Also, no longer booleanify for internal usage.
  • Loading branch information
lizmat committed Jan 11, 2016
1 parent 43b5642 commit 4e78adc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 0 additions & 3 deletions src/core/IO.pm
Expand Up @@ -122,9 +122,6 @@ sub REMOVE-DIR(Str $path --> True) {
} }
}

sub FILETEST-X(Str $abspath) {
nqp::p6bool(nqp::fileexecutable(nqp::unbox_s($abspath)));
}
sub FILETEST-RWX(Str $abspath) {
my str $p = nqp::unbox_s($abspath);
nqp::p6bool(
Expand Down
2 changes: 1 addition & 1 deletion src/core/IO/Local.pm
Expand Up @@ -56,7 +56,7 @@ my role IO::Local {
method r(IO::Local:D:) { ?Rakudo::Internals.FILETEST-R( $!abspath) }
method w(IO::Local:D:) { ?Rakudo::Internals.FILETEST-W( $!abspath) }
method rw(IO::Local:D:) { ?Rakudo::Internals.FILETEST-RW( $!abspath) }
method x(IO::Local:D:) { FILETEST-X( $!abspath) }
method x(IO::Local:D:) { ?Rakudo::Internals.FILETEST-X( $!abspath) }
method rwx(IO::Local:D:) { FILETEST-RWX($!abspath) }
method z(IO::Local:D:) { FILETEST-Z( $!abspath) }
method modified(IO::Local:D:) { FILETEST-MODIFIED($!abspath) }
Expand Down
7 changes: 4 additions & 3 deletions src/core/IO/Path.pm
Expand Up @@ -579,9 +579,10 @@ my class IO::Path is Cool {
!! fail X::IO::DoesNotExist.new(:path(~self),:trying<w>)
}

method x() {
fail X::IO::DoesNotExist.new(:path(self.Str),:trying<x>) if !$.e;
FILETEST-X($!abspath);
method x(--> Bool) {
$.e
?? ?Rakudo::Internals.FILETEST-X($!abspath)
!! fail X::IO::DoesNotExist.new(:path(~self),:trying<x>)
}

method rwx() {
Expand Down
3 changes: 3 additions & 0 deletions src/core/Rakudo/Internals.pm
Expand Up @@ -1027,6 +1027,9 @@ my class Rakudo::Internals {
my str $abspath = nqp::unbox_s(abspath);
nqp::filereadable($abspath) && nqp::filewritable($abspath)
}
method FILETEST-X(Str:D \abspath) {
nqp::fileexecutable(nqp::unbox_s(abspath))
}
}

# vim: ft=perl6 expandtab sw=4

0 comments on commit 4e78adc

Please sign in to comment.