changeset 5593:4218b56833b3

Give the label name when warning or erroring, bytecomp.el 2011-11-02 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-lambda): Accept a new NAME argument here, have byte-compile-current-form reflect that if it's specified. * bytecomp.el (byte-compile-initial-macro-environment): Specify the label name when byte-compiling it, so warning and errors are more helpful.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 02 Nov 2011 17:50:39 +0000
parents 2dbefd79b3d3
children cc8ea7ed4286
files lisp/ChangeLog lisp/bytecomp.el
diffstat 2 files changed, 27 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Oct 29 01:10:32 2011 +0900
+++ b/lisp/ChangeLog	Wed Nov 02 17:50:39 2011 +0000
@@ -1,3 +1,12 @@
+2011-11-02  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* bytecomp.el (byte-compile-lambda):
+	Accept a new NAME argument here, have byte-compile-current-form
+	reflect that if it's specified. 
+	* bytecomp.el (byte-compile-initial-macro-environment):
+	Specify the label name when byte-compiling it, so warning and
+	errors are more helpful.
+
 2011-10-17  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* startup.el (load-terminal-library):
--- a/lisp/bytecomp.el	Sat Oct 29 01:10:32 2011 +0900
+++ b/lisp/bytecomp.el	Wed Nov 02 17:50:39 2011 +0000
@@ -563,24 +563,25 @@
                                               'byte-optimizer)
                                         'byte-compile-inline-expand)
                                        `(((function ,placeholder)
-                                          ,(byte-compile-lambda lambda)
+                                          ,(byte-compile-lambda lambda name)
                                           (function ,lambda)))))
                                   names placeholders lambdas))
                                (compiled
-                                (mapcar #'byte-compile-lambda 
-                                        (if (not inline)
-                                            lambdas
-                                          ;; See further down for the
+                                (mapcar* #'byte-compile-lambda 
+                                         (if (not inline)
+                                             lambdas
+                                           ;; See further down for the
                                           ;; rationale of the sublis calls.
-                                          (sublis (pairlis
-                                                   (mapcar #'cadar inline)
-                                                   (mapcar #'third inline))
-                                                  (sublis
-                                                   (pairlis
-                                                    (mapcar #'car inline)
-                                                    (mapcar #'second inline))
-                                                   lambdas :test #'equal)
-                                                  :test #'eq))))
+                                           (sublis (pairlis
+                                                    (mapcar #'cadar inline)
+                                                    (mapcar #'third inline))
+                                                   (sublis
+                                                    (pairlis
+                                                     (mapcar #'car inline)
+                                                     (mapcar #'second inline))
+                                                    lambdas :test #'equal)
+                                                   :test #'eq))
+                                         names))
                                elt)
                           (mapc #'(lambda (placeholder function)
                                     (nsubst function placeholder compiled
@@ -2736,10 +2737,11 @@
 ;; Byte-compile a lambda-expression and return a valid function.
 ;; The value is usually a compiled function but may be the original
 ;; lambda-expression.
-(defun byte-compile-lambda (fun)
+(defun byte-compile-lambda (fun &optional name)
   (or (eq 'lambda (car-safe fun))
       (error "not a lambda -- %s" (prin1-to-string fun)))
-  (let* ((arglist (nth 1 fun))
+  (let* ((byte-compile-current-form (or name byte-compile-current-form))
+         (arglist (nth 1 fun))
 	 (byte-compile-bound-variables
 	  (let ((new-bindings
 		 (mapcar #'(lambda (x) (cons x byte-compile-arglist-bit))