import now recognizes and ignore ``for'' spec.
This commit is contained in:
parent
a3f6e3e039
commit
d35566081b
Binary file not shown.
|
@ -1 +1 @@
|
||||||
1412
|
1413
|
||||||
|
|
|
@ -3257,9 +3257,27 @@
|
||||||
(values (cons (id->sym x) name) pred))]
|
(values (cons (id->sym x) name) pred))]
|
||||||
[() (values '() (lambda (x) #t))]
|
[() (values '() (lambda (x) #t))]
|
||||||
[_ (stx-error spec "invalid import spec")])))
|
[_ (stx-error spec "invalid import spec")])))
|
||||||
|
(define (import-library spec*)
|
||||||
|
(let-values ([(name pred) (parse-library-name spec*)])
|
||||||
|
(when (null? name)
|
||||||
|
(syntax-violation 'import "empty library name" spec*))
|
||||||
|
(let ((lib (find-library-by-name name)))
|
||||||
|
(unless lib
|
||||||
|
(syntax-violation 'import
|
||||||
|
"cannot find library with required name"
|
||||||
|
name))
|
||||||
|
(unless (pred (library-version lib))
|
||||||
|
(syntax-violation 'import
|
||||||
|
"library does not satisfy version specification"
|
||||||
|
spec* lib))
|
||||||
|
((imp-collector) lib)
|
||||||
|
(library-subst lib))))
|
||||||
(define (get-import spec)
|
(define (get-import spec)
|
||||||
(syntax-match spec ()
|
(syntax-match spec ()
|
||||||
((rename isp (old* new*) ...)
|
((x x* ...)
|
||||||
|
(not (memq (syntax->datum x) '(for rename except only prefix library)))
|
||||||
|
(import-library (cons x x*)))
|
||||||
|
((rename isp (old* new*) ...)
|
||||||
(and (eq? (syntax->datum rename) 'rename)
|
(and (eq? (syntax->datum rename) 'rename)
|
||||||
(for-all id? old*)
|
(for-all id? old*)
|
||||||
(for-all id? new*))
|
(for-all id? new*))
|
||||||
|
@ -3295,24 +3313,10 @@
|
||||||
(cdr x)))
|
(cdr x)))
|
||||||
subst)))
|
subst)))
|
||||||
((library (spec* ...)) (eq? (syntax->datum library) 'library)
|
((library (spec* ...)) (eq? (syntax->datum library) 'library)
|
||||||
;;; FIXME: versioning stuff
|
(import-library spec*))
|
||||||
(let-values ([(name pred) (parse-library-name spec*)])
|
((for isp . rest)
|
||||||
(when (null? name)
|
(eq? (syntax->datum for) 'for)
|
||||||
(syntax-violation 'import "empty library name" spec*))
|
(get-import isp))
|
||||||
(let ((lib (find-library-by-name name)))
|
|
||||||
(unless lib
|
|
||||||
(syntax-violation 'import
|
|
||||||
"cannot find library with required name"
|
|
||||||
name))
|
|
||||||
(unless (pred (library-version lib))
|
|
||||||
(syntax-violation 'import
|
|
||||||
"library does not satisfy version specification"
|
|
||||||
spec* lib))
|
|
||||||
((imp-collector) lib)
|
|
||||||
(library-subst lib))))
|
|
||||||
((x x* ...)
|
|
||||||
(not (memq (syntax->datum x) '(rename except only prefix library)))
|
|
||||||
(get-import `(library (,x . ,x*))))
|
|
||||||
(spec (syntax-violation 'import "invalid import spec" spec))))
|
(spec (syntax-violation 'import "invalid import spec" spec))))
|
||||||
(define (add-imports! imp h)
|
(define (add-imports! imp h)
|
||||||
(let ([subst (get-import imp)])
|
(let ([subst (get-import imp)])
|
||||||
|
|
Loading…
Reference in New Issue