YAML: don't use aliases/anchors for fixnums

db4
Jon Harper 2014-05-10 15:33:11 +02:00 committed by John Benediktsson
parent 41d2c1e10d
commit a2f4e84a9b
2 changed files with 11 additions and 1 deletions

View File

@ -563,3 +563,10 @@ ${ construct-value-obj } [ $ construct-value-obj >yaml-docs yaml-docs> ] unit-te
[ "- foo\n:)" yaml> ] [ libyaml-parser-error? ] must-fail-with
[ "- &foo 1\n- *baz\n" yaml> ] [ yaml-undefined-anchor? ] must-fail-with
[ "" yaml> ] [ yaml-no-document? ] must-fail-with
! !!!!!!!!!!!!!!!
! misc
! Don't use aliases/anchors for equal fixnums
{ f } [ CHAR: & { 0 0 } >yaml member? ] unit-test

View File

@ -268,7 +268,7 @@ GENERIC: (replace-aliases) ( yaml-anchors obj -- obj' )
[ next-anchor<< ] bi*
] bi ;
:: ?replace-aliases ( yaml-anchors obj -- obj' )
:: (?replace-aliases) ( yaml-anchors obj -- obj' )
yaml-anchors objects>> :> objects
obj objects at* [
[ yaml-anchors incr-anchor dup obj objects set-at ] unless*
@ -280,6 +280,9 @@ GENERIC: (replace-aliases) ( yaml-anchors obj -- obj' )
obj'
] if ;
: ?replace-aliases ( yaml-anchors obj -- obj' )
dup fixnum? [ nip ] [ (?replace-aliases) ] if ;
M: object (replace-aliases) nip ;
M: byte-array (replace-aliases) nip ;