summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/system/base/message.scm19
1 files 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>")))
;;;