py/native: Improve support for bool type in viper functions.

Variables with type bool now act more like an int, and there is proper
casting to/from Python objects.
This commit is contained in:
Damien George
2019-05-03 23:18:30 +10:00
parent 9a6f6fd68d
commit 5ea38e4d74
4 changed files with 36 additions and 2 deletions

View File

@@ -1356,7 +1356,7 @@ STATIC void emit_native_load_global(emit_t *emit, qstr qst, int kind) {
if (emit->do_viper_types) {
// check for builtin casting operators
int native_type = mp_native_type_from_qstr(qst);
if (native_type >= MP_NATIVE_TYPE_INT) {
if (native_type >= MP_NATIVE_TYPE_BOOL) {
emit_post_push_imm(emit, VTYPE_BUILTIN_CAST, native_type);
return;
}