[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/3] utils: Add 'location->source-properties'.
From: |
宋文武 |
Subject: |
[PATCH 2/3] utils: Add 'location->source-properties'. |
Date: |
Wed, 6 Apr 2016 18:37:25 +0800 |
* guix/utils (location-source->properties): New procedure.
---
guix/utils.scm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/guix/utils.scm b/guix/utils.scm
index 1318dac..50f4bcd 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -60,6 +60,7 @@
location-line
location-column
source-properties->location
+ location->source-properties
nix-system->gnu-triplet
gnu-triplet->nix-system
@@ -892,3 +893,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))))
--
2.6.3