1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-21 20:20:24 +02:00

Properly display locations in "source vector" form.

Locations are stored in tree-il records in "source vector" form, but
`location-string' was rendering these as <unknown-location>.

* module/system/base/message.scm (location-string): Support locations
passed as a file/line/column vector.
This commit is contained in:
Andrew Whatson 2022-08-26 11:50:21 +02:00 committed by Daniel Llorens
parent c746586de3
commit eb5ecf4944

View file

@ -41,12 +41,19 @@
;;; ;;;
(define (location-string loc) (define (location-string loc)
(if (pair? loc) (define (format-loc file line column)
(format #f "~a:~a:~a" (format #f "~a:~a:~a"
(or (assoc-ref loc 'filename) "<stdin>") (or file "<stdin>")
(1+ (assoc-ref loc 'line)) (1+ line)
(assoc-ref loc 'column)) column))
"<unknown-location>")) (match loc
(#(file line column)
(format-loc file line column))
((? pair? loc)
(format-loc (assoc-ref loc 'filename)
(assoc-ref loc 'line)
(assoc-ref loc 'column)))
(_ "<unknown-location>")))
;;; ;;;