Skip to content
Browse files

Top removal: NewMuAnyScalar

  • Loading branch information...
1 parent f2586f9 commit 3ffe64c5afc1b1ea7ed8de3f7576d20dd4087ff9 @sorear committed Nov 13, 2012
Showing with 15 additions and 11 deletions.
  1. +2 −2 lib/CodeGen.cs
  2. +13 −9 lib/Kernel.cs
View
4 lib/CodeGen.cs
@@ -2504,7 +2504,7 @@ class NamProcessor {
} else if ((flags & Parameter.IS_LIST) != 0) {
init = CpsOp.MethodCall(Tokens.Kernel_CreateArray);
} else if (type == null) {
- init = CpsOp.MethodCall(Tokens.Kernel_NewMuAnyScalar);
+ init = CpsOp.MethodCall(Tokens.Kernel_NewMuAnyScalar, CpsOp.CallFrame());
} else {
init = CpsOp.MethodCall(Tokens.Kernel_NewTypedScalar,
eu.TypeConstant(type));
@@ -2853,7 +2853,7 @@ class NamProcessor {
return CpsOp.MethodCall(Tokens.Kernel_NewTypedScalar,
(CpsOp)z[1]); };
thandlers["newblankrwscalar"] = delegate(CpsOp[] z) {
- return CpsOp.MethodCall(Tokens.Kernel_NewMuAnyScalar); };
+ return CpsOp.MethodCall(Tokens.Kernel_NewMuAnyScalar, CpsOp.CallFrame()); };
// XXX - wrong order - problem?
thandlers["fvarlist_item"] = delegate(CpsOp[] z) {
return CpsOp.Operator(Tokens.Variable, OpCodes.Ldelem_Ref,
View
22 lib/Kernel.cs
@@ -165,7 +165,7 @@ public class ArrayViviHook : ViviHook {
public override void Do(Variable toviv) {
VarDeque vd = (VarDeque) ary.GetSlot(ary.mo.setting.ListMO, "$!items");
while (vd.Count() <= key)
- vd.Push(Kernel.NewMuAnyScalar());
+ vd.Push(ary.mo.setting.NewMuAnyScalar());
vd[key] = toviv;
}
public override void Freeze(FreezeBuffer fb) {
@@ -190,7 +190,7 @@ public class NewArrayViviHook : ViviHook {
public override void Do(Variable toviv) {
VarDeque vd = new VarDeque();
while (vd.Count() <= key)
- vd.Push(Kernel.NewMuAnyScalar());
+ vd.Push(mo.setting.NewMuAnyScalar());
vd[key] = toviv;
P6opaque d = new P6opaque(mo);
d.slots[0] = vd;
@@ -1293,7 +1293,7 @@ public class LISimple : LIVarish {
else if ((flags & HASH) != 0)
Set(f, owner.setting.CreateHash());
else
- Set(f, type == null ? Kernel.NewMuAnyScalar() : Kernel.NewTypedScalar(type));
+ Set(f, type == null ? owner.setting.NewMuAnyScalar() : Kernel.NewTypedScalar(type));
}
}
@@ -2778,7 +2778,7 @@ public class Frame: P6any, IFixup {
src = Kernel.Assign(setting.CreateArray(),
Kernel.NewRWListVar(src.Fetch()));
else
- src = Kernel.Assign(type == null ? Kernel.NewMuAnyScalar() : Kernel.NewTypedScalar(type), src);
+ src = Kernel.Assign(type == null ? setting.NewMuAnyScalar() : Kernel.NewTypedScalar(type), src);
} else {
bool islist = ((flags & (Parameter.IS_HASH | Parameter.IS_LIST)) != 0);
bool rw = ((flags & Parameter.READWRITE) != 0) && !islist;
@@ -4125,7 +4125,7 @@ class IxListBindPos : BindHandler {
if (ix < 0)
throw new NieczaException("binding to out of range slot " + ix);
while (items.Count() <= ix) {
- items.Push(Kernel.NewMuAnyScalar());
+ items.Push(setting.NewMuAnyScalar());
}
return items[ix] = to;
}
@@ -4704,7 +4704,7 @@ public class Compartment {
return CreateArray();
if (name.Length >= 1 && name[0] == '%')
return CreateHash();
- return Kernel.NewMuAnyScalar();
+ return NewMuAnyScalar();
}
public static Variable StashyMerge(Variable o, Variable n, string d1, string d2) {
@@ -4738,12 +4738,16 @@ public class Compartment {
} else if (name.StartsWith("%")) {
v.v = CreateHash();
} else {
- v.v = Kernel.NewMuAnyScalar();
+ v.v = NewMuAnyScalar();
}
return v;
}
+ public Variable NewMuAnyScalar() {
+ return new RWVariable(null, null, AnyMO.typeObj);
+ }
+
// Produce a number from an int
public Variable MakeInt(int v) {
return Kernel.BoxAnyMO<int>(v, IntMO);
@@ -5413,8 +5417,8 @@ internal class MMDCandidate : MultiCandidate {
return new RWVariable(null, null, obj);
}
- public static Variable NewMuAnyScalar() {
- return new RWVariable(null, null, Compartment.Top.AnyMO.typeObj);
+ public static Variable NewMuAnyScalar(Frame f) {
+ return new RWVariable(null, null, f.info.setting.AnyMO.typeObj);
}
public static Variable NewTypedScalar(STable t) {

0 comments on commit 3ffe64c

Please sign in to comment.
Something went wrong with that request. Please try again.