extend decompiler to handle #%variable-reference

original commit: 5cc0baa01e
This commit is contained in:
Matthew Flatt 2010-07-20 06:35:58 -06:00
parent 3128c02641
commit b6a4c4ed65

View File

@ -176,14 +176,21 @@
[(struct boxenv (pos body)) [(struct boxenv (pos body))
(extract-ids! body ids)] (extract-ids! body ids)]
[else #f])) [else #f]))
(define (decompile-tl expr globs stack closed no-check?)
(match expr
[(struct toplevel (depth pos const? ready?))
(let ([id (list-ref/protect globs pos 'toplevel)])
(if (or no-check? const? ready?)
id
`(#%checked ,id)))]))
(define (decompile-expr expr globs stack closed) (define (decompile-expr expr globs stack closed)
(match expr (match expr
[(struct toplevel (depth pos const? ready?)) [(struct toplevel (depth pos const? ready?))
(let ([id (list-ref/protect globs pos 'toplevel)]) (decompile-tl expr globs stack closed #f)]
(if (or const? ready?) [(struct varref (tl))
id `(#%variable-reference ,(decompile-tl tl globs stack closed #t))]
`(#%checked ,id)))]
[(struct topsyntax (depth pos midpt)) [(struct topsyntax (depth pos midpt))
(list-ref/protect globs (+ midpt pos) 'topsyntax)] (list-ref/protect globs (+ midpt pos) 'topsyntax)]
[(struct primval (id)) [(struct primval (id))