StoreTyped(Method meth) { uint size = (uint)Marshal.SizeOf(typeof(PyMethodObject)); IntPtr methPtr = this.allocator.Alloc(size); CPyMarshal.Zero(methPtr, size); CPyMarshal.WriteIntField(methPtr, typeof(PyMethodObject), "ob_refcnt", 1); CPyMarshal.WritePtrField(methPtr, typeof(PyMethodObject), "ob_type", this.PyMethod_Type); CPyMarshal.WritePtrField(methPtr, typeof(PyMethodObject), "im_func", this.Store(meth.im_func)); CPyMarshal.WritePtrField(methPtr, typeof(PyMethodObject), "im_self", this.Store(meth.im_self)); CPyMarshal.WritePtrField(methPtr, typeof(PyMethodObject), "im_class", this.Store(meth.im_class)); this.map.Associate(methPtr, meth); return methPtr; }
internal override bool TryGetValue(CodeContext context, object instance, PythonType owner, out object value) { if (this.im_self == null) { if (owner == null || owner == im_class || PythonOps.IsSubClass(context, owner, im_class)) { value = new Method(_func, instance, owner); return true; } } value = this; return true; }
internal override bool TryGetValue(CodeContext context, object instance, PythonType owner, out object value) { value = new Method(this, instance, owner); return true; }
internal override bool TryGetValue(CodeContext context, object instance, PythonType owner, out object value) { value = new Method(this, instance, owner); return(true); }
internal override bool TryGetValue(CodeContext context, object instance, PythonType owner, out object value) { owner = CheckGetArgs(context, instance, owner); value = new Method(_func, owner, DynamicHelpers.GetPythonType(owner)); return true; }
internal override bool TryGetValue(CodeContext context, object instance, PythonType owner, out object value) { owner = CheckGetArgs(context, instance, owner); value = new Method(_func, owner, DynamicHelpers.GetPythonType(owner)); return(true); }