flet/labels: make same function name error message more descriptive

Signed-off-by: Daniel Kochmański <daniel@turtleware.eu>
This commit is contained in:
Daniel Kochmański 2015-08-17 12:15:53 +02:00
parent e289af9500
commit 8869a54bde
2 changed files with 5 additions and 4 deletions

View file

@ -1349,7 +1349,7 @@ c_labels_flet(cl_env_ptr env, int op, cl_object args, int flags) {
cl_object l, def_list = pop(&args);
cl_object old_vars = env->c_env->variables;
cl_object old_funs = env->c_env->macros;
cl_object fnames = ecl_list1(CAAR(def_list));
cl_object fnames = ECL_NIL;
cl_object v, *f = &fnames;
cl_index nfun;
@ -1360,11 +1360,12 @@ c_labels_flet(cl_env_ptr env, int op, cl_object args, int flags) {
/* ANSI doesn't specify what should happen if we define
multiple functions of the same name in the flet/labels
block ECL treats this undefined behavior as an error */
for (l = ECL_CONS_CDR(def_list), nfun = 1; !Null(l); nfun++) {
for (l = def_list, nfun = 0; !Null(l); nfun++) {
v = CAR(pop(&l));
if (ecl_member_eq(v, fnames))
FEprogram_error_noreturn
("The function ~s was already defined.", 1, v);
("~s: The function ~s was already defined.",
2, (op == OP_LABELS ? @'LABELS' : @'FLET'), v);
push(v, f);
}

View file

@ -35,7 +35,7 @@
(endp (cdr def)))
"The local function definition ~s is illegal." def)
(cmpck (member (car def) fnames)
"The function ~s was already defined." (car def))
"~s: The function ~s was already defined." origin (car def))
(push (car def) fnames)
(let* ((name (car def))
(var (make-var :name name :kind :object))