mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +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:
parent
c746586de3
commit
eb5ecf4944
1 changed files with 13 additions and 6 deletions
|
@ -41,12 +41,19 @@
|
|||
;;;
|
||||
|
||||
(define (location-string loc)
|
||||
(if (pair? loc)
|
||||
(format #f "~a:~a:~a"
|
||||
(or (assoc-ref loc 'filename) "<stdin>")
|
||||
(1+ (assoc-ref loc 'line))
|
||||
(assoc-ref loc 'column))
|
||||
"<unknown-location>"))
|
||||
(define (format-loc file line column)
|
||||
(format #f "~a:~a:~a"
|
||||
(or file "<stdin>")
|
||||
(1+ line)
|
||||
column))
|
||||
(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>")))
|
||||
|
||||
|
||||
;;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue