Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Move FILETEST-F to Rakudo::Internals
Also, no longer booleanify for internal usage.
  • Loading branch information
lizmat committed Jan 11, 2016
1 parent 15b4a8f commit f90282b
Show file tree
Hide file tree
Showing 4 changed files with 7 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-F(Str $abspath) {
nqp::p6bool( nqp::stat(nqp::unbox_s($abspath),nqp::const::STAT_ISREG) );
}
sub FILETEST-S(Str $abspath) {
nqp::p6box_i(nqp::stat(nqp::unbox_s($abspath),nqp::const::STAT_FILESIZE) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/IO/Local.pm
Expand Up @@ -50,7 +50,7 @@ my role IO::Local {
method pred(IO::Local:D:) { $!abspath.pred }

method e(IO::Local:D:) { True }
method f(IO::Local:D:) { FILETEST-F( $!abspath) }
method f(IO::Local:D:) { ?Rakudo::Internals.FILETEST-F( $!abspath) }
method s(IO::Local:D:) { FILETEST-S( $!abspath) }
method l(IO::Local:D:) { FILETEST-L( $!abspath) }
method r(IO::Local:D:) { FILETEST-R( $!abspath) }
Expand Down
5 changes: 3 additions & 2 deletions src/core/IO/Path.pm
Expand Up @@ -542,8 +542,9 @@ my class IO::Path is Cool {
}

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

method s() {
Expand Down
4 changes: 3 additions & 1 deletion src/core/Rakudo/Internals.pm
Expand Up @@ -1005,10 +1005,12 @@ my class Rakudo::Internals {
method FILETEST-E(Str:D \abspath) {
nqp::stat(nqp::unbox_s(abspath),nqp::const::STAT_EXISTS)
}

method FILETEST-D(Str:D \abspath) {
nqp::stat(nqp::unbox_s(abspath),nqp::const::STAT_ISDIR)
}
method FILETEST-F(Str:D \abspath) {
nqp::stat(nqp::unbox_s(abspath),nqp::const::STAT_ISREG)
}
}

# vim: ft=perl6 expandtab sw=4

0 comments on commit f90282b

Please sign in to comment.