Example #1
0
        private static IokeObject CreateSuperCallFor(IokeObject out_self, IokeObject out_context, IokeObject out_message, object out_on, string out_name)
        {
            return(out_context.runtime.NewNativeMethod("will call the super method of the current message on the same receiver",
                                                       new NativeMethod("super", DefaultArgumentsDefinition.builder()
                                                                        .WithRestUnevaluated("arguments")
                                                                        .Arguments,
                                                                        (method, context, message, on, outer) => {
                object superCell = context.runtime.nul;
                string realname = out_name;
                if (realname != null)
                {
                    superCell = IokeObject.FindSuperCellOn(out_on, out_self, out_context, realname);
                }
                if (superCell == context.runtime.nul)
                {
                    realname = Message.GetName(out_message);
                    superCell = IokeObject.FindSuperCellOn(out_on, out_self, out_context, realname);
                }

                if (superCell != context.runtime.nul)
                {
                    if (IokeObject.dataOf(superCell) is Method)
                    {
                        return Interpreter.Activate(((IokeObject)superCell), context, message, out_on);
                    }
                    else
                    {
                        return superCell;
                    }
                }
                else
                {
                    return Interpreter.SignalNoSuchCell(message, context, out_on, realname, superCell, out_self);
                }
            })));
        }