Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix indirect-name package autovivification
  • Loading branch information
sorear committed Oct 27, 2011
1 parent 878afab commit 9c51257
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 0 additions & 2 deletions lib/CORE.setting
Expand Up @@ -1138,8 +1138,6 @@ my class Array is List {
# Not connected to Hash because Stash contains bvalues while Hash
# holds values directly.
my class Stash {
has $.name;
method at_key($key) {
Q:CgOp { (stash_at_key (@ {self}) (obj_getstr {$key})) } }
method bind_key($key, \$to) {
Expand Down
9 changes: 4 additions & 5 deletions lib/Kernel.cs
Expand Up @@ -3705,10 +3705,9 @@ public struct StashCursor {
if (final) return;

if (v.rw && !v.Fetch().IsDefined()) {
Variable vname = Kernel.RunInferior(who.InvokeMethod(
Kernel.GetInferiorRoot(), "name",
new Variable[] { whov }, null));
string name = vname.Fetch().mo.mro_raw_Str.Get(vname);
if (!who.Isa(Kernel.StashMO))
throw new NieczaException("Autovivification only implemented for normal-type stashes");
string name = Kernel.UnboxAny<string>(who);
P6any new_who = Kernel.BoxRaw(name + "::" + key, Kernel.StashMO);
who.mo.mro_bind_key.Bind(whov, keyv,
MakePackage(key, new_who));
Expand Down Expand Up @@ -3770,7 +3769,7 @@ public struct StashCursor {
n.p1 = (key == "PARENT" || key.Length > 0 &&
"$&@%".IndexOf(key[0]) >= 0)
? ToInfo().cur_pkg.who
: Kernel.GetVar("", "GLOBAL").v.Fetch();
: Kernel.GetVar("", "GLOBAL").v.Fetch().mo.who;
n.Core(key, final, out sc, out v, bind_to);
return;
}
Expand Down

0 comments on commit 9c51257

Please sign in to comment.