prettyprint.backend: leave nesting-limit unset when prettyprinting hashtables without a nesting limit, fixing the bug where it would get set to 1 and print nothing (reported by Blei)
parent
5966a65ade
commit
8c9c0f05d2
|
@ -226,9 +226,13 @@ M: object pprint-object ( obj -- )
|
|||
M: object pprint* pprint-object ;
|
||||
M: vector pprint* pprint-object ;
|
||||
M: byte-vector pprint* pprint-object ;
|
||||
|
||||
: with-extra-nesting-level ( quot -- )
|
||||
nesting-limit [ dup [ 1 + ] [ f ] if* ] change
|
||||
[ nesting-limit set ] curry [ ] cleanup ; inline
|
||||
|
||||
M: hashtable pprint*
|
||||
nesting-limit inc
|
||||
[ pprint-object ] [ nesting-limit dec ] [ ] cleanup ;
|
||||
[ pprint-object ] with-extra-nesting-level ;
|
||||
M: curry pprint* pprint-object ;
|
||||
M: compose pprint* pprint-object ;
|
||||
M: hash-set pprint* pprint-object ;
|
||||
|
|
|
@ -374,3 +374,16 @@ TUPLE: final-tuple ; final
|
|||
] [
|
||||
[ \ final-tuple see ] with-string-writer "\n" split
|
||||
] unit-test
|
||||
|
||||
[ "H{ { 1 2 } }\n" ] [ [ H{ { 1 2 } } short. ] with-string-writer ] unit-test
|
||||
|
||||
[ "H{ { 1 ~array~ } }\n" ] [ [ H{ { 1 { 2 } } } short. ] with-string-writer ] unit-test
|
||||
|
||||
[ "{ ~array~ }\n" ] [ [ { { 1 2 } } short. ] with-string-writer ] unit-test
|
||||
|
||||
[ "H{ { 1 { 2 3 } } }\n" ] [
|
||||
f nesting-limit [
|
||||
[ H{ { 1 { 2 3 } } } . ] with-string-writer
|
||||
] with-variable
|
||||
] unit-test
|
||||
|
||||
|
|
Loading…
Reference in New Issue