summaryrefslogtreecommitdiff
path: root/scheme/racket/geiser/modules.rkt
diff options
context:
space:
mode:
Diffstat (limited to 'scheme/racket/geiser/modules.rkt')
-rw-r--r--scheme/racket/geiser/modules.rkt20
1 files changed, 13 insertions, 7 deletions
diff --git a/scheme/racket/geiser/modules.rkt b/scheme/racket/geiser/modules.rkt
index 0ab372a..6ed2ecc 100644
--- a/scheme/racket/geiser/modules.rkt
+++ b/scheme/racket/geiser/modules.rkt
@@ -138,24 +138,30 @@
module-cache)
(define (module-exports mod)
+ (define (value id) (dynamic-require mod id (const #f)))
+ (define (contracted id)
+ (let ([v (value id)])
+ (if (has-contract? v)
+ (cons id (contract-name (value-contract v)))
+ id)))
(define (extract-ids ls)
(append-map (lambda (idls)
(map car (cdr idls)))
ls))
- (define (classify-ids ids ns)
+ (define (classify-ids ids)
(let loop ([ids ids] [procs '()] [vars '()])
(cond [(null? ids)
- `((procs ,@(reverse procs)) (vars ,@(reverse vars)))]
- [(procedure?
- (namespace-variable-value (car ids) #t (const #f) ns))
+ `((procs ,@(map contracted (reverse procs)))
+ (vars ,@(map contracted (reverse vars))))]
+ [(procedure? (value (car ids)))
(loop (cdr ids) (cons (car ids) procs) vars)]
[else (loop (cdr ids) procs (cons (car ids) vars))])))
(let-values (((reg syn)
(module-compiled-exports
(get-module-code (resolve-module-path mod #f)))))
- (let ((syn (extract-ids syn))
- (reg (extract-ids reg)))
- `((syntax ,@syn) ,@(classify-ids reg (module-spec->namespace mod))))))
+ (let ([syn (map contracted (extract-ids syn))]
+ [reg (extract-ids reg)])
+ `((syntax ,@syn) ,@(classify-ids reg)))))
(define (startup)
(thread update-module-cache)