From c1b2e3e52b079756c6ab378dc4815cd12b3d1e71 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Wed, 19 Apr 2023 12:25:23 +0800 Subject: [PATCH] ... --- src/vm.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vm.h b/src/vm.h index fc861b42..3d542714 100644 --- a/src/vm.h +++ b/src/vm.h @@ -230,10 +230,12 @@ public: return call_method(self, callable, args...); } - PyObject* property(NativeFuncC fget){ + PyObject* property(NativeFuncC fget, NativeFuncC fset=nullptr){ PyObject* p = builtins->attr("property"); - PyObject* method = heap.gcnew(tp_native_func, NativeFunc(fget, 1, false)); - return call(p, method); + PyObject* _0 = heap.gcnew(tp_native_func, NativeFunc(fget, 1, false)); + PyObject* _1 = vm->None; + if(fset != nullptr) _1 = heap.gcnew(tp_native_func, NativeFunc(fset, 2, false)); + return call(p, _0, _1); } PyObject* new_type_object(PyObject* mod, StrName name, Type base){