mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-20 01:33:18 -05:00
utils: Add 'location->source-properties'.
* guix/utils (location-source->properties): New procedure.
This commit is contained in:
parent
50a3d59473
commit
f7df1e3efb
1 changed files with 8 additions and 0 deletions
|
@ -61,6 +61,7 @@ (define-module (guix utils)
|
|||
location-line
|
||||
location-column
|
||||
source-properties->location
|
||||
location->source-properties
|
||||
|
||||
nix-system->gnu-triplet
|
||||
gnu-triplet->nix-system
|
||||
|
@ -895,3 +896,10 @@ (define (source-properties->location loc)
|
|||
;; In accordance with the GCS, start line and column numbers at 1. Note
|
||||
;; that unlike LINE and `port-column', COL is actually 1-indexed here...
|
||||
(location file (and line (+ line 1)) col)))
|
||||
|
||||
(define (location->source-properties loc)
|
||||
"Return the source property association list based on the info in LOC,
|
||||
a location object."
|
||||
`((line . ,(and=> (location-line loc) 1-))
|
||||
(column . ,(location-column loc))
|
||||
(filename . ,(location-file loc))))
|
||||
|
|
Loading…
Reference in a new issue