Remove redundant LENGTH calls in NSUBSTITUTE[-IF[-NOT]]
[sbcl.git] / src / code / source-location.lisp
index 7eb411b..be1abd2 100644 (file)
   ;; Namestring of the source file that the definition was compiled from.
   ;; This is null if the definition was not compiled from a file.
   (namestring
-   (when (and (boundp '*source-info*)
-              *source-info*)
-     (make-file-info-namestring *compile-file-pathname*
-                                (sb!c:get-toplevelish-file-info *source-info*)))
+   (or *source-namestring*
+       (when (and (boundp '*source-info*)
+                  *source-info*)
+         (make-file-info-namestring *compile-file-pathname*
+                                    (sb!c:get-toplevelish-file-info *source-info*))))
    :type (or string null))
   ;; Toplevel form index
   (toplevel-form-number
@@ -37,8 +38,9 @@
     (let ((src (position "src" dir :test #'string=
                          :from-end t)))
       (cond
-        (src (format nil "SYS:~{~:@(~A~);~}~:@(~A~).LISP"
-                     (subseq dir src) (pathname-name untruename)))
+        ((and src (not (string= (car (last dir)) "output")))
+         (format nil "SYS:~{~:@(~A~);~}~:@(~A~).LISP"
+                 (subseq dir src) (pathname-name untruename)))
         (t (aver (string-equal (car (last dir)) "output"))
            (aver (string-equal (pathname-name untruename) "stuff-groveled-from-headers"))
            (aver (string-equal (pathname-type untruename) "lisp"))