mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-15 00:47:34 +02:00
Warn when importing bad bindings with `only'.
This commit is contained in:
parent
cd708b9f90
commit
f2502229e6
1 changed files with 15 additions and 3 deletions
18
lib/meta.scm
18
lib/meta.scm
|
@ -49,6 +49,15 @@
|
|||
(define (symbol-append a b)
|
||||
(string->symbol (string-append (symbol->string a) (symbol->string b))))
|
||||
|
||||
;; (define (warn msg . args)
|
||||
;; (display msg (current-error-port))
|
||||
;; (display ":" (current-error-port))
|
||||
;; (for-each (lambda (a)
|
||||
;; (display " " (current-error-port))
|
||||
;; (write a (current-error-port)))
|
||||
;; args)
|
||||
;; (newline (current-error-port)))
|
||||
|
||||
(define (to-id id) (if (pair? id) (car id) id))
|
||||
(define (from-id id) (if (pair? id) (cdr id) id))
|
||||
(define (id-filter pred ls)
|
||||
|
@ -67,12 +76,15 @@
|
|||
(and (not (eq? 'only (car x)))
|
||||
(module-exports
|
||||
(find-module (car mod-name+imports)))))))
|
||||
;; (if (not (eq? 'only (car x)))
|
||||
;; (let ((unbound
|
||||
;; (id-filter (lambda (i) (not (memq i imp-ids))) (cddr x))))
|
||||
;; (if (pair? unbound)
|
||||
;; (warn "import excepting unbound identifiers" unbound))))
|
||||
(cons (car mod-name+imports)
|
||||
(case (car x)
|
||||
((only)
|
||||
(if (not imp-ids)
|
||||
(cddr x)
|
||||
(id-filter (lambda (i) (memq i (cddr x))) imp-ids)))
|
||||
(cddr x))
|
||||
((except)
|
||||
(id-filter (lambda (i) (not (memq i (cddr x)))) imp-ids))
|
||||
((rename)
|
||||
|
|
Loading…
Add table
Reference in a new issue