From 90750029df8d7fd24600cc4fe4c98a5b80731f28 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 1 Feb 2014 15:05:04 +0200 Subject: Implement default function arguments (for Python functions). TODO: Decide if we really need separate bytecode for creating functions with default arguments - we would need same for closures, then there're keywords arguments too. Having all combinations is a small exponential explosion, likely we need just 2 cases - simplest (no defaults, no kw), and full - defaults & kw. --- py/runtime.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'py/runtime.h') diff --git a/py/runtime.h b/py/runtime.h index c8113f4a7..10c262a60 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -12,7 +12,7 @@ void rt_store_name(qstr qstr, mp_obj_t obj); void rt_store_global(qstr qstr, mp_obj_t obj); mp_obj_t rt_unary_op(int op, mp_obj_t arg); mp_obj_t rt_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs); -mp_obj_t rt_make_function_from_id(int unique_code_id); +mp_obj_t rt_make_function_from_id(int unique_code_id, mp_obj_t def_args); mp_obj_t rt_make_function_n(int n_args, void *fun); // fun must have the correct signature for n_args fixed arguments mp_obj_t rt_make_function_var(int n_args_min, mp_fun_var_t fun); mp_obj_t rt_make_function_var_between(int n_args_min, int n_args_max, mp_fun_var_t fun); // min and max are inclusive -- cgit v1.2.3