Skip to content

Commit

Permalink
Potentially fix problem
Browse files Browse the repository at this point in the history
nine++ reported that 8ac2eec broke
t/04-nativecall/00-misc.t , which I cannot reproduce.  However,
that commit did change the semantics slightly: instead of an Any,
a Nil would be returned for a non-existing path.  But since the
check used //= , any subsequent attemopt would run the same code
again, as //= does not differentiate between Nil and Any.

This patch does not bind to the loaded hash if the path does not
exist, effectively still having the same semantics as a non-existing
key returns nqp::null.
  • Loading branch information
lizmat committed Feb 26, 2020
1 parent 4e3e937 commit 6c7ffbd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/core.c/CompUnit/PrecompilationStore/File.pm6
Expand Up @@ -202,14 +202,14 @@ class CompUnit::PrecompilationStore::File
my str $key = $precomp-id.Str;
nqp::ifnull(
nqp::atkey($!loaded,$key),
nqp::bindkey($!loaded,$key,
do {
my $path := self.path($compiler-id, $precomp-id);
$path.e
?? CompUnit::PrecompilationUnit::File.new(:id($precomp-id), :$path, :store(self))
!! Nil
}
)
do {
my $path := self.path($compiler-id, $precomp-id);
$path.e
?? nqp::bindkey($!loaded,$key,
CompUnit::PrecompilationUnit::File.new(
:id($precomp-id), :$path, :store(self)))
!! Nil
}
)
}
}
Expand Down

0 comments on commit 6c7ffbd

Please sign in to comment.