| 18368 | |
| 18369 | template <bool is_yielding, typename Fx, typename T, typename... Args> |
| 18370 | void select_member_function_with(lua_State* L, Fx&& fx, T&& obj, Args&&... args) { |
| 18371 | using dFx = std::decay_t<Fx>; |
| 18372 | using Tu = meta::unqualified_t<T>; |
| 18373 | if constexpr (meta::is_specialization_of_v<Tu, function_detail::class_indicator>) { |
| 18374 | (void)obj; |
| 18375 | using C = typename Tu::type; |
| 18376 | lua_CFunction freefunc = &function_detail::upvalue_this_member_function<C, dFx, is_yielding>::call; |
| 18377 | |
| 18378 | int upvalues = 0; |
| 18379 | upvalues += stack::push(L, nullptr); |
| 18380 | upvalues += stack::push<user<dFx>>(L, std::forward<Fx>(fx), std::forward<Args>(args)...); |
| 18381 | stack::push(L, c_closure(freefunc, upvalues)); |
| 18382 | } |
| 18383 | else { |
| 18384 | constexpr bool is_reference = meta::is_specialization_of_v<Tu, std::reference_wrapper> || std::is_pointer_v<Tu>; |
| 18385 | if constexpr (is_reference) { |
| 18386 | auto userptr = detail::ptr(std::forward<T>(obj)); |
| 18387 | lua_CFunction freefunc = &function_detail::upvalue_member_function<std::decay_t<decltype(*userptr)>, dFx, is_yielding>::call; |
| 18388 | |
| 18389 | int upvalues = 0; |
| 18390 | upvalues += stack::push(L, nullptr); |
| 18391 | upvalues += stack::push<user<dFx>>(L, std::forward<Fx>(fx), std::forward<Args>(args)...); |
| 18392 | upvalues += stack::push(L, lightuserdata_value(static_cast<void*>(userptr))); |
| 18393 | stack::push(L, c_closure(freefunc, upvalues)); |
| 18394 | } |
| 18395 | else { |
| 18396 | using F = function_detail::member_function<Tu, dFx, is_yielding>; |
| 18397 | select_set_fx<false, false, F>(L, std::forward<Fx>(fx), std::forward<T>(obj), std::forward<Args>(args)...); |
| 18398 | } |
| 18399 | } |
| 18400 | } |
| 18401 | |
| 18402 | template <bool is_yielding, typename Fx, typename... Args> |
| 18403 | void select_member_function(lua_State* L, Fx&& fx, Args&&... args) { |
nothing calls this directly
no test coverage detected