mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-30 08:50:23 +02:00
(cond-expand): Define using
`procedure->memoizing-macro' to get at the lexical environment. Use `env-module' instead of `current-module' to get the right module.
This commit is contained in:
parent
e24ca5385a
commit
9f79272ab3
1 changed files with 61 additions and 59 deletions
|
@ -2741,9 +2741,10 @@
|
|||
(append (hashq-ref %cond-expand-table mod '())
|
||||
features)))))
|
||||
|
||||
(define-macro (cond-expand clause . clauses)
|
||||
|
||||
(let ((clauses (cons clause clauses))
|
||||
(define cond-expand
|
||||
(procedure->memoizing-macro
|
||||
(lambda (exp env)
|
||||
(let ((clauses (cdr exp))
|
||||
(syntax-error (lambda (cl)
|
||||
(error "invalid clause in `cond-expand'" cl))))
|
||||
(letrec
|
||||
|
@ -2752,10 +2753,11 @@
|
|||
(cond
|
||||
((symbol? clause)
|
||||
(or (memq clause %cond-expand-features)
|
||||
(let lp ((uses (module-uses (current-module))))
|
||||
(let lp ((uses (module-uses (env-module env))))
|
||||
(if (pair? uses)
|
||||
(or (memq clause
|
||||
(hashq-ref %cond-expand-table (car uses) '()))
|
||||
(hashq-ref %cond-expand-table
|
||||
(car uses) '()))
|
||||
(lp (cdr uses)))
|
||||
#f))))
|
||||
((pair? clause)
|
||||
|
@ -2801,7 +2803,7 @@
|
|||
(syntax-error c))
|
||||
`(begin ,@(cdar c)))
|
||||
(else
|
||||
(lp (cdr c))))))))
|
||||
(lp (cdr c))))))))))
|
||||
|
||||
;; This procedure gets called from the startup code with a list of
|
||||
;; numbers, which are the numbers of the SRFIs to be loaded on startup.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue