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){