flet/labels: make same function name error message more descriptive
authorDaniel Kochmański <daniel@turtleware.eu>
Mon, 17 Aug 2015 10:15:53 +0000 (12:15 +0200)
committerDaniel Kochmański <daniel@turtleware.eu>
Mon, 17 Aug 2015 10:15:53 +0000 (12:15 +0200)
Signed-off-by: Daniel Kochmański <daniel@turtleware.eu>
src/c/compiler.d
src/cmp/cmpflet.lsp

index ee27855..b617eae 100644 (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);
         }
 
index 7ed0a93..3353df9 100644 (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))