summaryrefslogtreecommitdiff
path: root/guix/utils.scm
diff options
context:
space:
mode:
author宋文武 <iyzsong@gmail.com>2016-04-06 18:31:12 +0800
committer宋文武 <iyzsong@gmail.com>2016-04-13 09:17:01 +0800
commitf7df1e3efb4d4a67065b0eddc7eb02a8cb81fa21 (patch)
tree3b543765e4809dd243d9799a8b16cca88725b911 /guix/utils.scm
parent50a3d59473acf9fb5e771b57528b09d3e66123c4 (diff)
downloadgnu-guix-f7df1e3efb4d4a67065b0eddc7eb02a8cb81fa21.tar
gnu-guix-f7df1e3efb4d4a67065b0eddc7eb02a8cb81fa21.tar.gz
utils: Add 'location->source-properties'.
* guix/utils (location-source->properties): New procedure.
Diffstat (limited to 'guix/utils.scm')
-rw-r--r--guix/utils.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/guix/utils.scm b/guix/utils.scm
index f566a994eb..a0e9439dd3 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -61,6 +61,7 @@
location-line
location-column
source-properties->location
+ location->source-properties
nix-system->gnu-triplet
gnu-triplet->nix-system
@@ -895,3 +896,10 @@ etc."
;; 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))))