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

@ -177,13 +177,20 @@
(extract-ids! body ids)] (extract-ids! body ids)]
[else #f])) [else #f]))
(define (decompile-expr expr globs stack closed) (define (decompile-tl expr globs stack closed no-check?)
(match expr (match expr
[(struct toplevel (depth pos const? ready?)) [(struct toplevel (depth pos const? ready?))
(let ([id (list-ref/protect globs pos 'toplevel)]) (let ([id (list-ref/protect globs pos 'toplevel)])
(if (or const? ready?) (if (or no-check? const? ready?)
id id
`(#%checked ,id)))] `(#%checked ,id)))]))
(define (decompile-expr expr globs stack closed)
(match expr
[(struct toplevel (depth pos const? ready?))
(decompile-tl expr globs stack closed #f)]
[(struct varref (tl))
`(#%variable-reference ,(decompile-tl tl globs stack closed #t))]
[(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))