summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2010-12-07 12:26:07 +0100
committerAndy Wingo <wingo@pobox.com>2010-12-07 13:21:01 +0100
commitd1079217947013dac495a95e433ad5da9f7aa80a (patch)
treed78ea60cd2c581c64d37ee3326733b255c836817
parent1f845305c184814e253f0c4ac5a2aaac874b20a2 (diff)
downloadguile-d1079217947013dac495a95e433ad5da9f7aa80a.tar.gz
better unbound variable errors in the vm
* libguile/vm-i-system.c (variable-ref, toplevel-ref) (long-toplevel-ref): Fixup callers. * libguile/vm-engine.c (vm_error_unbound): Don't use vm-error for unbound vars, use misc-error. Don't include VM: in the string. Take the name directly in finish_args, not as a list.
-rw-r--r--libguile/vm-engine.c8
-rw-r--r--libguile/vm-i-system.c6
2 files changed, 8 insertions, 6 deletions
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index 5b38060d3..2e3a87644 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -139,9 +139,11 @@ VM_NAME (SCM vm, SCM program, SCM *argv, int nargs)
goto vm_error;
vm_error_unbound:
- /* At this point FINISH_ARGS should be a one-element list containing
- the name of the unbound variable. */
- err_msg = scm_from_locale_string ("VM: Unbound variable: ~s");
+ /* FINISH_ARGS should be the name of the unbound variable. */
+ SYNC_ALL ();
+ err_msg = scm_from_locale_string ("Unbound variable: ~s");
+ scm_error_scm (scm_misc_error_key, program, err_msg,
+ scm_list_1 (finish_args), SCM_BOOL_F);
goto vm_error;
vm_error_apply_to_non_list:
diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c
index bc0c9620d..e1aedd7cd 100644
--- a/libguile/vm-i-system.c
+++ b/libguile/vm-i-system.c
@@ -306,7 +306,7 @@ VM_DEFINE_INSTRUCTION (25, variable_ref, "variable-ref", 0, 1, 1)
/* Attempt to provide the variable name in the error message. */
var_name = scm_module_reverse_lookup (scm_current_module (), x);
- finish_args = scm_list_1 (scm_is_true (var_name) ? var_name : x);
+ finish_args = scm_is_true (var_name) ? var_name : x;
goto vm_error_unbound;
}
else
@@ -340,7 +340,7 @@ VM_DEFINE_INSTRUCTION (27, toplevel_ref, "toplevel-ref", 1, 0, 1)
resolved = resolve_variable (what, scm_program_module (program));
if (!VARIABLE_BOUNDP (resolved))
{
- finish_args = scm_list_1 (what);
+ finish_args = what;
goto vm_error_unbound;
}
what = resolved;
@@ -366,7 +366,7 @@ VM_DEFINE_INSTRUCTION (28, long_toplevel_ref, "long-toplevel-ref", 2, 0, 1)
resolved = resolve_variable (what, scm_program_module (program));
if (!VARIABLE_BOUNDP (resolved))
{
- finish_args = scm_list_1 (what);
+ finish_args = what;
goto vm_error_unbound;
}
what = resolved;