guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] branch main updated: Properly display locations in "sour


From: Daniel Llorens
Subject: [Guile-commits] branch main updated: Properly display locations in "source vector" form.
Date: Fri, 26 Aug 2022 06:48:40 -0400

This is an automated email from the git hooks/post-receive script.

lloda pushed a commit to branch main
in repository guile.

The following commit(s) were added to refs/heads/main by this push:
     new eb5ecf494 Properly display locations in "source vector" form.
eb5ecf494 is described below

commit eb5ecf4944cd646341f7e47dda5396cf96a4b8a3
Author: Andrew Whatson <whatson@gmail.com>
AuthorDate: Fri Aug 26 11:50:21 2022 +0200

    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.
---
 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>")))
 
 
 ;;;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]