From 3573c015f85b6f46c0fbe85c553cb708ee13fee7 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 8 Jan 2010 19:53:04 +0000 Subject: [PATCH] add module->compiled-module-expression, which is used in Scribble's traversal of module paths to find documented bindings svn: r17576 original commit: 4fedeeaf7a7bfd68132524536a9d692ddc8f318b --- collects/scribble/search.ss | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/collects/scribble/search.ss b/collects/scribble/search.ss index 86321b19..e2420d5b 100644 --- a/collects/scribble/search.ss +++ b/collects/scribble/search.ss @@ -17,6 +17,10 @@ (module-path-index-join name (module-path-index-rejoin base rel-to))]))) + (define (try thunk) + (with-handlers ([exn:fail? (lambda (exn) #f)]) + (thunk))) + (define (find-scheme-tag part ri stx/binding phase-level) ;; The phase-level argument is used only when `stx/binding' ;; is an identifier. @@ -106,12 +110,21 @@ rmp (lambda () (let-values ([(valss stxess) - (with-handlers ([exn:fail? - (lambda (exn) - (values null null))]) - (module-compiled-exports - (get-module-code (resolved-module-path-name rmp) - #:choose (lambda (src zo so) 'zo))))]) + (let ([exp + (or + (try + (lambda () + ;; First, try using bytecode: + (get-module-code (resolved-module-path-name rmp) + #:choose (lambda (src zo so) 'zo)))) + (try + (lambda () + ;; Bytecode not available. Declaration in the + ;; current namespace? + (module->compiled-module-expression rmp))))]) + (if exp + (module-compiled-exports exp) + (values null null)))]) (let ([t ;; Merge the two association lists: (let loop ([base valss]