1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 03:30:27 +02:00

(scm_lookupcar1): Report an "Undefined variable" insetad of an

"Unbound" one for variables that are found but still contain
SCM_UNDEFINED.
This commit is contained in:
Marius Vollmer 2004-08-20 12:26:46 +00:00
parent 892065da6c
commit 2d0c133f92

View file

@ -2680,6 +2680,10 @@ scm_ilookup (SCM iloc, SCM env)
SCM_SYMBOL (scm_unbound_variable_key, "unbound-variable");
static void error_unbound_variable (SCM symbol) SCM_NORETURN;
static void error_defined_variable (SCM symbol) SCM_NORETURN;
/* Call this for variables that are unfound.
*/
static void
error_unbound_variable (SCM symbol)
{
@ -2688,6 +2692,20 @@ error_unbound_variable (SCM symbol)
scm_list_1 (symbol), SCM_BOOL_F);
}
/* Call this for variables that are found but contain SCM_UNDEFINED.
*/
static void
error_defined_variable (SCM symbol)
{
/* We use the 'unbound-variable' key here as well, since it
basically is the same kind of error, with a slight variation in
the displayed message.
*/
scm_error (scm_unbound_variable_key, NULL,
"Undefined variable: ~S",
scm_list_1 (symbol), SCM_BOOL_F);
}
/* The Lookup Car Race
- by Eva Luator
@ -2791,10 +2809,7 @@ scm_lookupcar1 (SCM vloc, SCM genv, int check)
if (scm_is_eq (SCM_CAR (fl), var))
{
if (SCM_UNBNDP (SCM_CAR (*al)))
{
env = SCM_EOL;
goto errout;
}
error_defined_variable (var);
if (!scm_is_eq (SCM_CAR (vloc), var))
goto race;
SCM_SETCAR (vloc, iloc);