From 7e01997e88c54216678271de36b1c2088377492d Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 17 Oct 2009 17:23:09 +0200 Subject: finish support for optional & keyword args; update ecmascript compiler * libguile/_scm.h (SCM_OBJCODE_MINOR_VERSION): Bump. * libguile/vm-i-system.c (br-if-nargs-ne, br-if-args-lt) (br-if-nargs-gt): New instructions, for use by different lambda cases. (bind-optionals, bind-optionals/shuffle, bind-kwargs): New instructions, for binding optional and keyword arguments. Renumber other ops. * module/language/ecmascript/compile-tree-il.scm (comp, comp-body): Update for new tree-il. Use the new optional argument mechanism instead of emulating it with rest arguments. * module/language/glil/compile-assembly.scm (glil->assembly): Tweaks for optional and keyword argument compilation. * module/language/tree-il.scm (parse-tree-il, unparse-tree-il): Make the else case optional, in the s-expression serialization of tree-il. * module/language/tree-il/compile-glil.scm (flatten): Handle all of the lambda-case capabilities. --- libguile/vm-engine.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libguile/vm-engine.c') diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c index f86a49876..5d8f65587 100644 --- a/libguile/vm-engine.c +++ b/libguile/vm-engine.c @@ -170,6 +170,21 @@ VM_NAME (struct scm_vm *vp, SCM program, SCM *argv, int nargs) finish_args = SCM_EOL; goto vm_error; + vm_error_kwargs_length_not_even: + err_msg = scm_from_locale_string ("Bad keyword argument list: odd length"); + finish_args = SCM_EOL; + goto vm_error; + + vm_error_kwargs_invalid_keyword: + err_msg = scm_from_locale_string ("Bad keyword argument list: expected keyword"); + finish_args = SCM_EOL; + goto vm_error; + + vm_error_kwargs_unrecognized_keyword: + err_msg = scm_from_locale_string ("Bad keyword argument list: unrecognized keyword"); + finish_args = SCM_EOL; + goto vm_error; + vm_error_too_many_args: err_msg = scm_from_locale_string ("VM: Too many arguments"); finish_args = scm_list_1 (scm_from_int (nargs)); -- cgit v1.2.3