decompile: avoid single-subexpression begin0

At the bytecode level, `(begin0 E)` does not make E in tail position
with respect to the `begin0` form. It does at the source level, so
generate suitable source.
This commit is contained in:
Matthew Flatt 2016-03-05 05:49:05 -07:00
parent 2a1dd00320
commit 209a4ff631

View File

@ -505,8 +505,11 @@
`(begin ,@(for/list ([expr (in-list exprs)])
(decompile-expr expr globs stack closed)))]
[(struct beg0 (exprs))
`(begin0 ,@(for/list ([expr (in-list exprs)])
(decompile-expr expr globs stack closed)))]
`(begin0
,@(for/list ([expr (in-list exprs)])
(decompile-expr expr globs stack closed))
;; Make sure a single expression doesn't look like tail position:
,@(if (null? (cdr exprs)) (list #f) null))]
[(struct with-cont-mark (key val body))
`(with-continuation-mark
,(decompile-expr key globs stack closed)