Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Top removal: SubInfo.ctor, STable.ctor
  • Loading branch information
sorear committed Nov 13, 2012
1 parent 532462b commit 8864bf6
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 83 deletions.
8 changes: 4 additions & 4 deletions lib/Builtins.cs
Expand Up @@ -2717,7 +2717,7 @@ class CrossSource: ItemSource {
while (Kernel.IterHasFlat(iter, true))
roles.Add(iter.Shift().Fetch().mo);

STable n = new STable(obj.mo.name + "+" + Kernel.JoinS(",", roles));
STable n = new STable(c.setting, obj.mo.name + "+" + Kernel.JoinS(",", roles));

n.how = Kernel.BoxAny<STable>(n, obj.mo.how).Fetch();
n.typeObj = n.initObj = new P6opaque(n);
Expand Down Expand Up @@ -2800,7 +2800,7 @@ class CrossSource: ItemSource {
}

public static Variable enum_mixin_role(string name, P6any meth) {
STable r = new STable('{' + name + '}');
STable r = new STable(meth.mo.setting, '{' + name + '}');
r.mo.FillRole(new STable[0], null);
r.typeObj = r.initObj = new P6opaque(r);
r.mo.AddMethod(0, name, meth);
Expand All @@ -2811,7 +2811,7 @@ class CrossSource: ItemSource {

// TODO: merge
public static Variable cat_mixin_role(string name, P6any meth) {
STable r = new STable('{' + name + '}');
STable r = new STable(meth.mo.setting, '{' + name + '}');
r.mo.FillRole(new STable[0], null);
r.typeObj = r.initObj = new P6opaque(r);
r.mo.AddMethod(P6how.M_MULTI, name, meth);
Expand All @@ -2823,7 +2823,7 @@ class CrossSource: ItemSource {
public static Variable type_mixin_role(Variable type, Variable meth) {
STable stype = type.Fetch().mo;
string name = stype.name;
STable r = new STable("ANON");
STable r = new STable(stype.setting, "ANON");

r.mo.FillRole(new STable[0], null);
r.typeObj = r.initObj = new P6opaque(r);
Expand Down
5 changes: 3 additions & 2 deletions lib/CodeGen.cs
Expand Up @@ -356,7 +356,7 @@ sealed class Tokens {
public static readonly MethodInfo Kernel_NewLabelVar =
typeof(Kernel).GetMethod("NewLabelVar");
public static readonly MethodInfo Kernel_MakeDispatcher =
typeof(Kernel).GetMethod("MakeDispatcher");
typeof(Kernel).GetMethod("MakeDispatcherF");
public static readonly MethodInfo Kernel_Die =
typeof(Kernel).GetMethod("Die");
public static readonly MethodInfo Kernel_SFH =
Expand Down Expand Up @@ -2278,6 +2278,7 @@ class NamProcessor {
}

return CpsOp.MethodCall(Tokens.Kernel_MakeDispatcher,
CpsOp.CallFrame(),
CpsOp.StringLiteral(prefix), proto,
CpsOp.NewArray(Tokens.P6any, cands.ToArray()));
}
Expand Down Expand Up @@ -4331,7 +4332,7 @@ public class DowncallReceiver : CallReceiver {

STable nst = mof == null ? null : (STable)mof.GetValue(ru.setting);
if (nst == null) { // not all FooMO are initialized by kernel
nst = new STable(name);
nst = new STable(ru.setting, name);
if (mof != null) mof.SetValue(ru.setting, nst);
}
// Hack - we don't clear the MRO here, because we might need
Expand Down
8 changes: 3 additions & 5 deletions lib/Cursor.cs
Expand Up @@ -601,7 +601,7 @@ public sealed class RxFrame: IFreeze {
}

public Frame proto_dispatch(Frame th, Variable unused) {
Frame nth = th.MakeChild(null, Lexer.StandardProtoSI, global.setting.AnyP);
Frame nth = th.MakeChild(null, th.info.setting.StandardLexerSI, global.setting.AnyP);
nth.pos = new Variable[] { MakeCursorV() };
return nth;
}
Expand Down Expand Up @@ -2147,8 +2147,6 @@ public class Lexer {
return ret;
}

internal static SubInfo StandardProtoSI =
new SubInfo("KERNEL protoregex", StandardProtoC);
internal static Frame StandardProtoC(Frame th) {
Variable[] al;
switch (th.ip) {
Expand Down Expand Up @@ -2183,13 +2181,13 @@ public class Lexer {
}
}

public static P6any MakeDispatcher(string name, P6any proto, P6any[] cands) {
public static P6any MakeDispatcher(Compartment s, string name, P6any proto, P6any[] cands) {
if (proto != null) {
SubInfo si = new SubInfo(Kernel.GetInfo(proto));
si.param = new object[] { cands, null };
return Kernel.MakeSub(si, Kernel.GetOuter(proto));
} else {
SubInfo si = new SubInfo(name, StandardProtoC);
SubInfo si = new SubInfo(s, name, StandardProtoC);
si.param = new object[] { cands, null };
si.ltm = new LADDispatcher();
return Kernel.MakeSub(si, null);
Expand Down

0 comments on commit 8864bf6

Please sign in to comment.