summaryrefslogtreecommitdiffstatshomepage
path: root/py/objfun.c
diff options
context:
space:
mode:
authorJohn R. Lenton <jlenton@gmail.com>2014-01-04 01:15:01 +0000
committerJohn R. Lenton <jlenton@gmail.com>2014-01-04 01:15:01 +0000
commit45a87446179c0c629a2ae89e24fa61919a57c0e5 (patch)
treee193d701573541468cd338a465eb5b83a813bc7f /py/objfun.c
parent5d4a8213395b1e27d303379772c90b3b0adc82d5 (diff)
downloadmicropython-45a87446179c0c629a2ae89e24fa61919a57c0e5.tar.gz
micropython-45a87446179c0c629a2ae89e24fa61919a57c0e5.zip
Implements list.insert. Fixes issue #61.
Diffstat (limited to 'py/objfun.c')
-rw-r--r--py/objfun.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/py/objfun.c b/py/objfun.c
index e998bd28d2..9601622d89 100644
--- a/py/objfun.c
+++ b/py/objfun.c
@@ -38,6 +38,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;
@@ -106,6 +109,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;