public bool CheckSubset(P6any obj) { if (!obj.Does(superclasses[0])) { return(false); } if (subsetFilter == null) { subsetFilter = Kernel.RunInferior(subsetWhereThunk.Invoke( Kernel.GetInferiorRoot(), Variable.None, null)); } Variable ret = Kernel.RunInferior(subsetFilter.Fetch(). InvokeMethod(Kernel.GetInferiorRoot(), "ACCEPTS", new Variable[] { subsetFilter, Kernel.NewROScalar(obj) }, null)); return(ret.Fetch().mo.mro_raw_Bool.Get(ret)); }
static object Callback(P6any fun, Type ret, object[] args, Type[] aty) { Variable[] pos = new Variable[args.Length]; for (int i = 0; i < args.Length; i++) { pos[i] = BoxResult(aty[i], args[i]); } Variable retv = Kernel.RunInferior(fun.Invoke( Kernel.GetInferiorRoot(), pos, null)); if (ret == typeof(void)) { return(null); } object reto; if (!CoerceArgument(out reto, ret, retv)) { throw new Exception("Return value coercion failed, " + retv.Fetch().mo.name + " to " + ret.FullName); } return(reto); }