gexp: Properly report substitution errors.
* guix/gexp.scm (gexp)[substitute-ungexp]: Wrap body in 'with-syntax' and pass EXP as the last argument to 'syntax-error'. [substitute-ungexp-splicing]: Pass EXP as the last argument to 'syntax-error'.
This commit is contained in:
parent
7be13d0006
commit
4a6e889feb
|
@ -1,5 +1,5 @@
|
||||||
;;; GNU Guix --- Functional package management for GNU
|
;;; GNU Guix --- Functional package management for GNU
|
||||||
;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
|
;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
|
||||||
;;;
|
;;;
|
||||||
;;; This file is part of GNU Guix.
|
;;; This file is part of GNU Guix.
|
||||||
;;;
|
;;;
|
||||||
|
@ -846,9 +846,9 @@ environment."
|
||||||
(match (assoc exp substs)
|
(match (assoc exp substs)
|
||||||
((_ id)
|
((_ id)
|
||||||
id)
|
id)
|
||||||
(_
|
(_ ;internal error
|
||||||
#'(syntax-error "error: no 'ungexp' substitution"
|
(with-syntax ((exp exp))
|
||||||
#'ref))))
|
#'(syntax-error "error: no 'ungexp' substitution" exp)))))
|
||||||
|
|
||||||
(define (substitute-ungexp-splicing exp substs)
|
(define (substitute-ungexp-splicing exp substs)
|
||||||
(syntax-case exp ()
|
(syntax-case exp ()
|
||||||
|
@ -860,7 +860,7 @@ environment."
|
||||||
#,(substitute-references #'(rest ...) substs))))
|
#,(substitute-references #'(rest ...) substs))))
|
||||||
(_
|
(_
|
||||||
#'(syntax-error "error: no 'ungexp-splicing' substitution"
|
#'(syntax-error "error: no 'ungexp-splicing' substitution"
|
||||||
#'ref))))))
|
exp))))))
|
||||||
|
|
||||||
(define (substitute-references exp substs)
|
(define (substitute-references exp substs)
|
||||||
;; Return a variant of EXP where all the cars of SUBSTS have been
|
;; Return a variant of EXP where all the cars of SUBSTS have been
|
||||||
|
|
Loading…
Reference in New Issue