Skip to content

Commit

Permalink
Revert my work on IO::Path.child and revision control
Browse files Browse the repository at this point in the history
By popular demand.
  • Loading branch information
lizmat committed May 25, 2020
1 parent 0279352 commit 8b94d8d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 44 deletions.
34 changes: 3 additions & 31 deletions src/core.c/IO/Path.pm6
@@ -1,5 +1,3 @@
my class Raku { ... }

my class IO::Path is Cool does IO {
has IO::Spec $.SPEC; # the associated IO::Spec
has Str $.CWD; # the associated CWD
Expand Down Expand Up @@ -363,35 +361,9 @@ my class IO::Path is Cool does IO {
!! $!SPEC.join($.volume, $.dirname, '')
}

# secure child logic
method !child-secure(\child) {
nqp::istype((my $kid := self.add(child).resolve: :completely),Failure)
?? $kid # kid failed
!! nqp::istype( # kid ok
(my $res-self := self.resolve: :completely),
Failure
)
?? $res-self # invocant failed
!! nqp::eqat( # invocant ok
$kid.absolute,
nqp::concat($res-self.absolute,$!SPEC.dir-sep),
0
)
?? $kid # kid-proper, ok!
!! Failure.new: X::IO::NotAChild.new: # not a proper kid
:path($res-self.absolute), :child($kid.absolute)
}

proto method child(|) {*}
multi method child (IO::Path:D: \child, :$secure!) {
$secure
?? self!child-secure(child)
!! self.add(child)
}
multi method child (IO::Path:D: \child) {
Raku.at-revision("e")
?? self!child-secure(\child)
!! self.add(child)
method child (IO::Path:D: \child) {
nqp::clone(self).cloned-with-path:
$!SPEC.join('', $!path, child.Str)
}

method add (IO::Path:D: \child) {
Expand Down
12 changes: 0 additions & 12 deletions src/core.c/Raku.pm6
Expand Up @@ -23,18 +23,6 @@ class Raku does Systemic {
!! nqp::bindkey($version-cache,$comp-ver,Version.new($comp-ver))
}
}

method revision(--> Str:D) {
nqp::substr(nqp::getcomp("Raku").language_version,2)
}
method at-revision(str $letter --> Bool:D) {
nqp::hllbool(
nqp::isge_s(
nqp::getcomp("Raku").language_version,
nqp::concat("6.",$letter)
)
)
}
}

class Perl is Raku { } # indeed :-)
Expand Down
1 change: 0 additions & 1 deletion t/spectest.data.6.c
Expand Up @@ -911,7 +911,6 @@ S32-hash/slice.t
S32-io/IO-Socket-Async.t
S32-io/IO-Socket-Async-UDP.t # moar
S32-io/chdir.t
S32-io/child-secure.t
S32-io/copy.t
S32-io/dir.t
S32-io/file-tests.t
Expand Down

0 comments on commit 8b94d8d

Please sign in to comment.