summaryrefslogtreecommitdiff
path: root/guix/gexp.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-09-24 10:11:38 +0200
committerLudovic Courtès <ludo@gnu.org>2019-09-24 10:11:38 +0200
commit11da634a6e64afa2904542e2174aa2a185f9ac3a (patch)
tree5aeb8e6bd01761813650067af492b1c336886e34 /guix/gexp.scm
parente5efdbce21a0afcbb3e73cc7b59111ccf62cb532 (diff)
parent7b3f56f5d7f4d2bb936e1579ed442e7f5b080abd (diff)
downloadpatches-11da634a6e64afa2904542e2174aa2a185f9ac3a.tar
patches-11da634a6e64afa2904542e2174aa2a185f9ac3a.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/gexp.scm')
-rw-r--r--guix/gexp.scm26
1 files changed, 12 insertions, 14 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index d9bdde2e42..44db75b7c2 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -994,6 +994,15 @@ references; otherwise, return only non-native references."
(target (%current-target-system)))
"Return (monadically) the sexp corresponding to EXP for the given OUTPUT,
and in the current monad setting (system type, etc.)"
+ (define (self-quoting? x)
+ (letrec-syntax ((one-of (syntax-rules ()
+ ((_) #f)
+ ((_ pred rest ...)
+ (or (pred x)
+ (one-of rest ...))))))
+ (one-of symbol? string? keyword? pair? null? array?
+ number? boolean?)))
+
(define* (reference->sexp ref #:optional native?)
(with-monad %store-monad
(match ref
@@ -1023,8 +1032,10 @@ and in the current monad setting (system type, etc.)"
#:target target)))
;; OBJ must be either a derivation or a store file name.
(return (expand thing obj output)))))
- (($ <gexp-input> x)
+ (($ <gexp-input> (? self-quoting? x))
(return x))
+ (($ <gexp-input> x)
+ (raise (condition (&gexp-input-error (input x)))))
(x
(return x)))))
@@ -1033,19 +1044,6 @@ and in the current monad setting (system type, etc.)"
reference->sexp (gexp-references exp))))
(return (apply (gexp-proc exp) args))))
-(define (syntax-location-string s)
- "Return a string representing the source code location of S."
- (let ((props (syntax-source s)))
- (if props
- (let ((file (assoc-ref props 'filename))
- (line (and=> (assoc-ref props 'line) 1+))
- (column (assoc-ref props 'column)))
- (if file
- (simple-format #f "~a:~a:~a"
- file line column)
- (simple-format #f "~a:~a" line column)))
- "<unknown location>")))
-
(define-syntax-rule (define-syntax-parameter-once name proc)
;; Like 'define-syntax-parameter' but ensure the top-level binding for NAME
;; does not get redefined. This works around a race condition in a