diff options
Diffstat (limited to 'py/objfun.c')
-rw-r--r-- | py/objfun.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/py/objfun.c b/py/objfun.c index 22b82a9ca0..0db6459a39 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -39,6 +39,9 @@ mp_obj_t fun_native_call_n(mp_obj_t self_in, int n_args, const mp_obj_t *args) { case 2: return ((mp_fun_2_t)self->fun)(args[1], args[0]); + case 3: + return ((mp_fun_3_t)self->fun)(args[2], args[1], args[0]); + default: assert(0); return mp_const_none; @@ -76,7 +79,7 @@ const mp_obj_type_t fun_native_type = { NULL, // binary_op NULL, // getiter NULL, // iternext - { // method list + .methods = { {NULL, NULL}, // end-of-list sentinel }, }; @@ -108,6 +111,15 @@ mp_obj_t rt_make_function_2(mp_fun_2_t fun) { return o; } +mp_obj_t rt_make_function_3(mp_fun_3_t fun) { + mp_obj_fun_native_t *o = m_new_obj(mp_obj_fun_native_t); + o->base.type = &fun_native_type; + o->n_args_min = 3; + o->n_args_max = 3; + o->fun = fun; + return o; +} + mp_obj_t rt_make_function_var(int n_args_min, mp_fun_var_t fun) { mp_obj_fun_native_t *o = m_new_obj(mp_obj_fun_native_t); o->base.type = &fun_native_type; @@ -169,7 +181,7 @@ const mp_obj_type_t fun_bc_type = { NULL, // binary_op NULL, // getiter NULL, // iternext - { // method list + .methods = { {NULL, NULL}, // end-of-list sentinel }, }; @@ -283,7 +295,7 @@ static const mp_obj_type_t fun_asm_type = { NULL, // binary_op NULL, // getiter NULL, // iternext - { // method list + .methods = { {NULL, NULL}, // end-of-list sentinel }, }; |