diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-06-04 00:29:59 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-06-04 12:08:02 +0200 |
commit | 4af0d97ee65f298be33d5959cd36a5bea8797be9 (patch) | |
tree | 863824da077e6800145db2b8f3cc10c3c551ce9a /libguile/eval.c | |
parent | 6fe2803b45fbbd676625c9d665151e5a8a57aca5 (diff) | |
download | guile-4af0d97ee65f298be33d5959cd36a5bea8797be9.tar.gz |
Print the faulty object upon invalid-keyword errors.
* libguile/vm.c (vm_error_kwargs_invalid_keyword,
vm_error_kwargs_unrecognized_keyword): Add parameter. Pass it
enclosed in a list as the last argument to `scm_error_scm'.
* libguile/vm-i-system.c (bind_kwargs): Adjust accordingly.
* libguile/eval.c (error_invalid_keyword, error_unrecognized_keyword):
Add parameter.
(prepare_boot_closure_env_for_apply): Adjust accordingly.
* module/ice-9/eval.scm (primitive-eval): Likewise.
* libguile/error.c (scm_error_scm): Mention `keyword-argument-error' in
docstring.
* module/ice-9/boot-9.scm (keyword-error-printer): New procedure; use it.
* test-suite/tests/optargs.test (c&e, with-test-prefix/c&e): Remove.
("define*")["unrecognized keyword"]: Test the value passed along the
`keyword-argument-error' exception.
["invalid keyword"]: New test.
* doc/ref/api-control.texi (Error Reporting): Update `scm-error'
description.
Diffstat (limited to 'libguile/eval.c')
-rw-r--r-- | libguile/eval.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libguile/eval.c b/libguile/eval.c index 0526f078d..6047d6d75 100644 --- a/libguile/eval.c +++ b/libguile/eval.c @@ -162,18 +162,18 @@ static void error_used_before_defined (void) "Variable used before given a value", SCM_EOL, SCM_BOOL_F); } -static void error_invalid_keyword (SCM proc) +static void error_invalid_keyword (SCM proc, SCM obj) { scm_error_scm (scm_from_latin1_symbol ("keyword-argument-error"), proc, scm_from_locale_string ("Invalid keyword"), SCM_EOL, - SCM_BOOL_F); + scm_list_1 (obj)); } -static void error_unrecognized_keyword (SCM proc) +static void error_unrecognized_keyword (SCM proc, SCM kw) { scm_error_scm (scm_from_latin1_symbol ("keyword-argument-error"), proc, scm_from_locale_string ("Unrecognized keyword"), SCM_EOL, - SCM_BOOL_F); + scm_list_1 (kw)); } @@ -890,10 +890,10 @@ prepare_boot_closure_env_for_apply (SCM proc, SCM args, break; } if (scm_is_null (walk) && scm_is_false (aok)) - error_unrecognized_keyword (proc); + error_unrecognized_keyword (proc, k); } if (scm_is_pair (args) && scm_is_false (rest)) - error_invalid_keyword (proc); + error_invalid_keyword (proc, CAR (args)); /* Now fill in unbound values, evaluating init expressions in their appropriate environment. */ |