cs: prinitng for unsafe-undefined

Although `unsafe-undefined` should never arrive at a printing
function, handle it a little better if it smoehow does.
This commit is contained in:
Matthew Flatt 2020-04-29 09:34:25 -06:00
parent 1646d294fd
commit d358a4135b

View File

@ -3,6 +3,7 @@
racket/fixnum racket/fixnum
racket/symbol racket/symbol
racket/keyword racket/keyword
racket/unsafe/undefined
"../common/check.rkt" "../common/check.rkt"
"../port/output-port.rkt" "../port/output-port.rkt"
"../port/input-port.rkt" "../port/input-port.rkt"
@ -343,6 +344,8 @@
(print-named "output-port" v mode o max-length)] (print-named "output-port" v mode o max-length)]
[(unquoted-printing-string? v) [(unquoted-printing-string? v)
(write-string/max (unquoted-printing-string-value v) o max-length)] (write-string/max (unquoted-printing-string-value v) o max-length)]
[(eq? v unsafe-undefined)
(write-string/max "#<unsafe-undefined>" o max-length)]
[else [else
;; As a last resort, fall back to the host `format`: ;; As a last resort, fall back to the host `format`:
(write-string/max (format "~s" v) o max-length)])) (write-string/max (format "~s" v) o max-length)]))