Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move FILETEST-W to Rakudo::Internals
Also, no longer booleanify for internal usage.
  • Loading branch information
lizmat committed Jan 11, 2016
1 parent 42191ca commit fe726c0
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-W(Str $abspath) {
nqp::p6bool(nqp::filewritable(nqp::unbox_s($abspath)));
}
sub FILETEST-RW(Str $abspath) {
my str $p = nqp::unbox_s($abspath);
nqp::p6bool(nqp::filereadable($p) && nqp::filewritable($p));
Expand Down
2 changes: 1 addition & 1 deletion src/core/IO/Local.pm
Expand Up @@ -54,7 +54,7 @@ my role IO::Local {
method s(IO::Local:D:) { Rakudo::Internals.FILETEST-S( $!abspath) }
method l(IO::Local:D:) { ?Rakudo::Internals.FILETEST-L( $!abspath) }
method r(IO::Local:D:) { ?Rakudo::Internals.FILETEST-R( $!abspath) }
method w(IO::Local:D:) { FILETEST-W( $!abspath) }
method w(IO::Local:D:) { ?Rakudo::Internals.FILETEST-W( $!abspath) }
method rw(IO::Local:D:) { FILETEST-RW( $!abspath) }
method x(IO::Local:D:) { FILETEST-X( $!abspath) }
method rwx(IO::Local:D:) { FILETEST-RWX($!abspath) }
Expand Down
7 changes: 4 additions & 3 deletions src/core/IO/Path.pm
Expand Up @@ -567,9 +567,10 @@ my class IO::Path is Cool {
!! fail X::IO::DoesNotExist.new(:path(~self),:trying<r>)
}

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

method rw() {
Expand Down
3 changes: 3 additions & 0 deletions src/core/Rakudo/Internals.pm
Expand Up @@ -1020,6 +1020,9 @@ my class Rakudo::Internals {
method FILETEST-R(Str:D \abspath) {
nqp::filereadable(nqp::unbox_s(abspath))
}
method FILETEST-W(Str:D \abspath) {
nqp::filewritable(nqp::unbox_s(abspath))
}
}

# vim: ft=perl6 expandtab sw=4

0 comments on commit fe726c0

Please sign in to comment.