diff options
| author | Damien George <damien@micropython.org> | 2024-02-16 16:52:38 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-02-20 10:56:24 +1100 |
| commit | 9400229766624e80db6a6f95af287a5542dc1b43 (patch) | |
| tree | 58d10d8a89679faa09f19da993712127017b1870 /py/emitglue.c | |
| parent | 648a7578da21cc7ddb4046fc59891144e797b983 (diff) | |
py/objfun: Split viper fun type out to separate mp_type_fun_viper type.
Viper functions are quite different to native functions and benefit from
being a separate type. For example, viper functions don't have a bytecode-
style prelude, and don't support generators or default arguments.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'py/emitglue.c')
| -rw-r--r-- | py/emitglue.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/py/emitglue.c b/py/emitglue.c index 7dc308087..415aa3a3d 100644 --- a/py/emitglue.c +++ b/py/emitglue.c @@ -199,13 +199,15 @@ mp_obj_t mp_make_function_from_proto_fun(mp_proto_fun_t proto_fun, const mp_modu switch (rc->kind) { #if MICROPY_EMIT_NATIVE case MP_CODE_NATIVE_PY: - case MP_CODE_NATIVE_VIPER: fun = mp_obj_new_fun_native(def_args, rc->fun_data, context, rc->children); // Check for a generator function, and if so change the type of the object if (rc->is_generator) { ((mp_obj_base_t *)MP_OBJ_TO_PTR(fun))->type = &mp_type_native_gen_wrap; } break; + case MP_CODE_NATIVE_VIPER: + fun = mp_obj_new_fun_viper(rc->fun_data, context, rc->children); + break; #endif #if MICROPY_EMIT_INLINE_ASM case MP_CODE_NATIVE_ASM: |
