From 473e78f6c3f62feb28d6d4c659cf30ddcb212d60 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 4 May 2024 13:50:38 +0800 Subject: [PATCH] remove `bind_func<>` --- include/pocketpy/vm.h | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/include/pocketpy/vm.h b/include/pocketpy/vm.h index f301b4f4..304ad736 100644 --- a/include/pocketpy/vm.h +++ b/include/pocketpy/vm.h @@ -295,10 +295,6 @@ public: void bind__getitem__(Type type, PyObject* (*f)(VM*, PyObject*, PyObject*)); void bind__setitem__(Type type, void (*f)(VM*, PyObject*, PyObject*, PyObject*)); void bind__delitem__(Type type, void (*f)(VM*, PyObject*, PyObject*)); - - template - PyObject* bind_func(PyObject*, StrName, NativeFuncC, UserData userdata={}, BindType bt=BindType::DEFAULT); - // new style binding api PyObject* bind_func(PyObject* obj, StrName name, int argc, NativeFuncC fn, UserData userdata={}, BindType bt=BindType::DEFAULT); PyObject* bind_func(Type type, StrName name, int argc, NativeFuncC fn, UserData userdata={}, BindType bt=BindType::DEFAULT){ @@ -549,19 +545,6 @@ __T py_cast(VM* vm, PyObject* obj) { return _py_cast__internal<__T, true>(vm, o template __T _py_cast(VM* vm, PyObject* obj) { return _py_cast__internal<__T, false>(vm, obj); } -template -PyObject* VM::bind_func(PyObject* obj, StrName name, NativeFuncC fn, UserData userdata, BindType bt) { - PyObject* nf = VAR(NativeFunc(fn, ARGC, false)); - PK_OBJ_GET(NativeFunc, nf).set_userdata(userdata); - switch(bt){ - case BindType::DEFAULT: break; - case BindType::STATICMETHOD: nf = VAR(StaticMethod(nf)); break; - case BindType::CLASSMETHOD: nf = VAR(ClassMethod(nf)); break; - } - obj->attr().set(name, nf); - return nf; -} - template PyObject* VM::bind_field(PyObject* obj, const char* name, F T::*field){ static_assert(!std::is_reference_v);