mirror of
https://github.com/ThePhD/sol2.git
synced 2024-03-22 13:10:44 +08:00
std decay, huh?
change base walk comparison to be less derp
This commit is contained in:
parent
015ef6a37a
commit
50f92be1c7
|
@ -84,6 +84,11 @@ namespace u_detail {
|
||||||
template <bool is_index = true, bool is_variable = false>
|
template <bool is_index = true, bool is_variable = false>
|
||||||
static int index_call_with_(lua_State* L, void* target) {
|
static int index_call_with_(lua_State* L, void* target) {
|
||||||
if constexpr (!is_variable) {
|
if constexpr (!is_variable) {
|
||||||
|
if constexpr (std::is_same_v<std::decay_t<F>, lua_CFunction> || std::is_same_v<std::decay_t<F>, lua_CFunction_ref>) {
|
||||||
|
auto& f = *static_cast<std::decay_t<F>*>(target);
|
||||||
|
return stack::push(L, f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
// set up upvalues
|
// set up upvalues
|
||||||
// for a chained call
|
// for a chained call
|
||||||
int upvalues = 0;
|
int upvalues = 0;
|
||||||
|
@ -92,6 +97,7 @@ namespace u_detail {
|
||||||
auto cfunc = &call<is_index, is_variable>;
|
auto cfunc = &call<is_index, is_variable>;
|
||||||
return stack::push(L, c_closure(cfunc, upvalues));
|
return stack::push(L, c_closure(cfunc, upvalues));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
constexpr int boost = !detail::is_non_factory_constructor<F>::value
|
constexpr int boost = !detail::is_non_factory_constructor<F>::value
|
||||||
&& std::is_same<K, call_construction>::value
|
&& std::is_same<K, call_construction>::value
|
||||||
|
@ -172,7 +178,7 @@ namespace u_detail {
|
||||||
// TODO: get base table, dump it out
|
// TODO: get base table, dump it out
|
||||||
usertype_storage_base& base_storage = get_usertype_storage<Base>(L);
|
usertype_storage_base& base_storage = get_usertype_storage<Base>(L);
|
||||||
base_result = self_index_call<true>(bases(), L, base_storage);
|
base_result = self_index_call<true>(bases(), L, base_storage);
|
||||||
keep_going = base_result != base_walking_failed_index;
|
keep_going = base_result == base_walking_failed_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
|
@ -185,8 +191,8 @@ namespace u_detail {
|
||||||
(void)self;
|
(void)self;
|
||||||
// TODO: get base table, dump it out
|
// TODO: get base table, dump it out
|
||||||
usertype_storage_base& base_storage = get_usertype_storage<Base>(L);
|
usertype_storage_base& base_storage = get_usertype_storage<Base>(L);
|
||||||
base_result = self_index_call<true>(bases(), L, base_storage);
|
base_result = self_new_index_call<true>(bases(), L, base_storage);
|
||||||
keep_going = base_result != base_walking_failed_index;
|
keep_going = base_result == base_walking_failed_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool base_walking = false, bool from_named_metatable = false, typename... Bases>
|
template <bool base_walking = false, bool from_named_metatable = false, typename... Bases>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user