diff options
author | Andrew Whatson <whatson@gmail.com> | 2022-08-26 11:50:21 +0200 |
---|---|---|
committer | Daniel Llorens <lloda@sarc.name> | 2022-08-26 12:34:39 +0200 |
commit | eb5ecf4944cd646341f7e47dda5396cf96a4b8a3 (patch) | |
tree | 48d52ea0c7c172489940e1c235c5287107f6dd68 | |
parent | c746586de3a1bee77185a414971b48f52de2547b (diff) | |
download | guile-eb5ecf4944cd646341f7e47dda5396cf96a4b8a3.tar.gz |
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.
-rw-r--r-- | module/system/base/message.scm | 19 |
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>"))) ;;; |