[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Properly display locations in "source vector" form.
From: |
Andrew Whatson |
Subject: |
[PATCH] Properly display locations in "source vector" form. |
Date: |
Fri, 26 Aug 2022 19:50:21 +1000 |
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.
---
module/system/base/message.scm | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/module/system/base/message.scm b/module/system/base/message.scm
index 3cd862bd4..869afa783 100644
--- a/module/system/base/message.scm
+++ b/module/system/base/message.scm
@@ -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>")))
;;;
--
2.37.2
- [PATCH] Properly display locations in "source vector" form.,
Andrew Whatson <=