diff options
author | Andy Wingo <wingo@pobox.com> | 2009-03-09 20:32:05 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2009-03-09 21:29:40 +0100 |
commit | 5e1ee6a9d0600feb3b9dd3b481abec55d691eedf (patch) | |
tree | db9a80cb6a59f596cf44ee8fa6e855a03fe201d1 | |
parent | 3e9cbb5732fdcdd032f0130d0717e9ae798c09ce (diff) | |
download | guile-5e1ee6a9d0600feb3b9dd3b481abec55d691eedf.tar.gz |
fix handling of pre-modules errors in the vm
* libguile/vm-i-system.c (toplevel-ref, toplevel-set): Correct situation
whereby we would not throw when toplevel vars were unbound, before
modules had booted.
-rw-r--r-- | libguile/vm-i-system.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c index c1ea1c161..495bfe906 100644 --- a/libguile/vm-i-system.c +++ b/libguile/vm-i-system.c @@ -284,7 +284,13 @@ VM_DEFINE_INSTRUCTION (25, toplevel_ref, "toplevel-ref", 1, 0, 1) /* might longjmp */ what = scm_module_lookup (mod, what); else - what = scm_sym2var (what, SCM_BOOL_F, SCM_BOOL_F); + { + SCM v = scm_sym2var (what, SCM_BOOL_F, SCM_BOOL_F); + if (scm_is_false (v)) + SCM_MISC_ERROR ("unbound variable: ~S", scm_list_1 (what)); + else + what = v; + } } else { @@ -367,7 +373,13 @@ VM_DEFINE_INSTRUCTION (29, toplevel_set, "toplevel-set", 1, 1, 0) /* might longjmp */ what = scm_module_lookup (mod, what); else - what = scm_sym2var (what, SCM_BOOL_F, SCM_BOOL_F); + { + SCM v = scm_sym2var (what, SCM_BOOL_F, SCM_BOOL_F); + if (scm_is_false (v)) + SCM_MISC_ERROR ("unbound variable: ~S", scm_list_1 (what)); + else + what = v; + } } else { |