mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-24 13:30:18 +00:00
some fix
This commit is contained in:
parent
7bfe8d4bbf
commit
4e8b0ea9d5
@ -103,7 +103,6 @@ struct Type {
|
|||||||
bool operator==(Type other) const { return this->index == other.index; }
|
bool operator==(Type other) const { return this->index == other.index; }
|
||||||
bool operator!=(Type other) const { return this->index != other.index; }
|
bool operator!=(Type other) const { return this->index != other.index; }
|
||||||
constexpr operator int() const { return index; }
|
constexpr operator int() const { return index; }
|
||||||
constexpr operator bool() const { return index != 0; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PK_LAMBDA(x) ([](VM* vm, ArgsView args) { return x; })
|
#define PK_LAMBDA(x) ([](VM* vm, ArgsView args) { return x; })
|
||||||
|
|||||||
@ -494,7 +494,7 @@ PyVar py_var(VM* vm, __T&& value){
|
|||||||
return from_void_p(vm, (void*)value);
|
return from_void_p(vm, (void*)value);
|
||||||
}else{
|
}else{
|
||||||
constexpr Type const_type = _find_type_in_const_cxx_typeid_map<T>();
|
constexpr Type const_type = _find_type_in_const_cxx_typeid_map<T>();
|
||||||
if constexpr(const_type){
|
if constexpr((bool)const_type){
|
||||||
if constexpr(is_sso_v<T>) return PyVar(const_type, value);
|
if constexpr(is_sso_v<T>) return PyVar(const_type, value);
|
||||||
else return vm->heap.gcnew<T>(const_type, std::forward<__T>(value));
|
else return vm->heap.gcnew<T>(const_type, std::forward<__T>(value));
|
||||||
}
|
}
|
||||||
@ -550,7 +550,7 @@ __T _py_cast__internal(VM* vm, PyVar obj) {
|
|||||||
return to_void_p<T>(vm, obj);
|
return to_void_p<T>(vm, obj);
|
||||||
}else{
|
}else{
|
||||||
constexpr Type const_type = _find_type_in_const_cxx_typeid_map<T>();
|
constexpr Type const_type = _find_type_in_const_cxx_typeid_map<T>();
|
||||||
if constexpr(const_type){
|
if constexpr((bool)const_type){
|
||||||
if constexpr(with_check){
|
if constexpr(with_check){
|
||||||
if constexpr(std::is_same_v<T, Exception>){
|
if constexpr(std::is_same_v<T, Exception>){
|
||||||
// Exception is `subclass_enabled`
|
// Exception is `subclass_enabled`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user