Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Avoid method dispatch calling Sub subclasses
  • Loading branch information
sorear committed Sep 13, 2010
1 parent 88f2d4b commit e0c8d34
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/Kernel.cs
Expand Up @@ -63,15 +63,17 @@ public abstract class IP6 {

public virtual Frame Invoke(Frame c, Variable[] p,
Dictionary<string, Variable> n) {
DynMetaObject.InvokeHandler ih = GetMO().OnInvoke;
if (ih != null) {
return ih(this, c, p, n);
} else {
Variable[] np = new Variable[p.Length + 1];
Array.Copy(p, 0, np, 1, p.Length);
np[0] = Kernel.NewROScalar(this);
return InvokeMethod(c, "INVOKE", np, n);
foreach (DynMetaObject k in GetMO().mro) {
DynMetaObject.InvokeHandler ih = k.OnInvoke;;
if (ih != null) {
return ih(this, c, p, n);
}
}

Variable[] np = new Variable[p.Length + 1];
Array.Copy(p, 0, np, 1, p.Length);
np[0] = Kernel.NewROScalar(this);
return InvokeMethod(c, "INVOKE", np, n);
}

public virtual Frame Fetch(Frame c) {
Expand Down

0 comments on commit e0c8d34

Please sign in to comment.