reorder `dump` precedence

main
Matthew Butterick 7 years ago
parent 5a99d3a380
commit b7ac0907ff

@ -42,14 +42,17 @@
(define (size o [val #f] [parent #f]) (send o size val parent)))])))
(define (dump x)
(define (dump-dict x)
(for/list ([(k v) (in-dict x)])
(cons (dump k) (dump v))))
(let loop ([x x])
(cond
[(input-port? x) (port->bytes x)]
[(output-port? x) (get-output-bytes x)]
[(dict? x) (for/list ([(k v) (in-dict x)])
(cons (loop k) (loop v)))]
[(and (object? x)
(memq 'dump (interface->method-names (object-interface x)))) (send x dump)]
[(dict? x) (dump-dict x)]
[(list? x) (map loop x)]
[(and (object? x) (memq 'dump (interface->method-names (object-interface x)))) (send x dump)]
[else x])))
#;(define dumpable<%>

Loading…
Cancel
Save