Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow for subclassing Sub
  • Loading branch information
sorear committed Jul 20, 2010
1 parent 534e6b4 commit cb5b9dd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Kernel.cs
Expand Up @@ -386,6 +386,19 @@ public class Kernel {

return n;
}
private static Frame SubInvokeSubC(Frame th) {
LValue[] post;
switch (th.ip) {
case 0:
th.ip = 1;
return th.pos[0].container.Fetch(th);
default:
post = new LValue[th.pos.Length - 1];
Array.Copy(th.pos, 1, post, 0, th.pos.Length - 1);
return SubInvoke((DynObject)th.resultSlot, th.caller,
post, th.named);
}
}

public static Frame Die(Frame caller, string msg) {
// TODO: Unbreak p6exceptions
Expand Down Expand Up @@ -612,6 +625,8 @@ public class Kernel {
SubMO.OnInvoke = new DynMetaObject.InvokeHandler(SubInvoke);
SubMO.local["clone"] = MakeSub(new DynBlockDelegate(SubCloneC),
null, null);
SubMO.local["INVOKE"] = MakeSub(new DynBlockDelegate(SubInvokeSubC),
null, null);

ScalarMO = new DynMetaObject("Scalar");
ScalarMO.OnFetch = new DynMetaObject.FetchHandler(SCFetch);
Expand Down

0 comments on commit cb5b9dd

Please sign in to comment.