From f0778a7ccbbdd1d7bf116a6939c7eb05173e1987 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sat, 7 Jun 2014 22:01:00 +0100 Subject: py: Implement default keyword only args. Should finish addressing issue #524. --- py/objfun.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'py/objfun.h') diff --git a/py/objfun.h b/py/objfun.h index b049e5c7e..f607a5eb6 100644 --- a/py/objfun.h +++ b/py/objfun.h @@ -30,10 +30,15 @@ typedef struct _mp_obj_fun_bc_t { machine_uint_t n_pos_args : 16; // number of arguments this function takes machine_uint_t n_kwonly_args : 16; // number of arguments this function takes machine_uint_t n_def_args : 16; // number of default arguments + machine_uint_t has_def_kw_args : 1; // set if this function has default keyword args machine_uint_t takes_var_args : 1; // set if this function takes variable args machine_uint_t takes_kw_args : 1; // set if this function takes keyword args const byte *bytecode; // bytecode for the function qstr *args; // argument names (needed to resolve positional args passed as keywords) - // values of default args (if any), plus a slot at the end for var args and/or kw args (if it takes them) + // the following extra_args array is allocated space to take (in order): + // - values of positional default args (if any) + // - a single slot for default kw args dict (if it has them) + // - a single slot for var args tuple (if it takes them) + // - a single slot for kw args dict (if it takes them) mp_obj_t extra_args[]; } mp_obj_fun_bc_t; -- cgit v1.2.3