diff options
author | Damien George <damien.p.george@gmail.com> | 2014-06-07 22:01:00 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-06-07 22:01:00 +0100 |
commit | f0778a7ccbbdd1d7bf116a6939c7eb05173e1987 (patch) | |
tree | 24a427ad51ea16deacc158a855b8c13b7c98f57c /py/objfun.h | |
parent | aabd83ea204325cdf45355a5bdc6838745484060 (diff) |
py: Implement default keyword only args.
Should finish addressing issue #524.
Diffstat (limited to 'py/objfun.h')
-rw-r--r-- | py/objfun.h | 7 |
1 files changed, 6 insertions, 1 deletions
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; |