blueloveTH 2 lat temu
rodzic
commit
c1b2e3e52b
1 zmienionych plików z 5 dodań i 3 usunięć
  1. 5 3
      src/vm.h

+ 5 - 3
src/vm.h

@@ -230,10 +230,12 @@ public:
         return call_method(self, callable, args...);
         return call_method(self, callable, args...);
     }
     }
 
 
-    PyObject* property(NativeFuncC fget){
+    PyObject* property(NativeFuncC fget, NativeFuncC fset=nullptr){
         PyObject* p = builtins->attr("property");
         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){
     PyObject* new_type_object(PyObject* mod, StrName name, Type base){