core: Bugfix: report name of undefined variable.

* mes.c (assert_defined): Add variable as parmeter, print it.  Update
  callers.
This commit is contained in:
Jan Nieuwenhuizen 2016-11-05 11:08:10 +01:00
parent 6c70e92276
commit ffd2d3df4f
1 changed files with 4 additions and 4 deletions

8
mes.c
View File

@ -205,7 +205,7 @@ scm *
set_env_x (scm *x, scm *e, scm *a) set_env_x (scm *x, scm *e, scm *a)
{ {
cache_invalidate (x); cache_invalidate (x);
scm *p = assert_defined (assq (x, a)); scm *p = assert_defined (x, assq (x, a));
return set_cdr_x (p, e); return set_cdr_x (p, e);
} }
@ -339,12 +339,12 @@ assq_ref_cache (scm *x, scm *a)
#endif // ENV_CACHE #endif // ENV_CACHE
scm * scm *
assert_defined (scm *e) assert_defined (scm *x, scm *e)
{ {
if (e == &scm_undefined) if (e == &scm_undefined)
{ {
fprintf (stderr, "eval: unbound variable:"); fprintf (stderr, "eval: unbound variable:");
display_ (stderr, e); display_ (stderr, x);
fprintf (stderr, "\n"); fprintf (stderr, "\n");
assert (!"unbound variable"); assert (!"unbound variable");
} }
@ -458,7 +458,7 @@ if (e->car == &symbol_define) {
if (x != e) return eval_env (x, a); if (x != e) return eval_env (x, a);
return apply_env (e->car, evlis_env (e->cdr, a), a); return apply_env (e->car, evlis_env (e->cdr, a), a);
} }
case SYMBOL: return assert_defined (assq_ref_cache (e, a)); case SYMBOL: return assert_defined (e, assq_ref_cache (e, a));
default: return e; default: return e;
} }
} }