racket/collects/errortrace/lang/body.rkt
Matthew Flatt a233697f08 fix errortrace (required API changes), add `syntax-shift-phase-level'
Also fix a bug in the `module' expander and streamline lazy
visits.
2011-09-13 21:04:10 -06:00

26 lines
870 B
Racket

#lang racket/base
(require (for-syntax racket/base
syntax/strip-context
racket/pretty
"../errortrace-lib.rkt"
"../private/utils.rkt"))
(provide (rename-out [module-begin #%module-begin]))
(define-syntax (module-begin stx)
(syntax-case stx ()
[(_ lang . body)
(let ([e (annotate-top
(values ; syntax-local-introduce
(local-expand #`(module . #,(strip-context #`(n lang . body)))
'top-level
null))
0)])
(collect-garbage)
(syntax-case e ()
[(mod nm lang (mb . body))
#`(#%plain-module-begin
(require (only-in lang))
#,(generate-key-imports ((count-meta-levels 0) #'(begin . body)))
. body)]))]))