Fix crash with bad each-object usage

db4
Slava Pestov 2008-07-25 17:37:51 -05:00
parent 2512729f78
commit cc09f334ef
2 changed files with 7 additions and 6 deletions

View File

@ -23,3 +23,6 @@ TUPLE: testing x y z ;
] when*
] each
] unit-test
! Erg's bug
2 [ [ [ 3 throw ] instances ] must-fail ] times

View File

@ -1,17 +1,15 @@
! Copyright (C) 2005, 2007 Slava Pestov.
! Copyright (C) 2005, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel continuations sequences arrays system ;
IN: memory
USING: arrays kernel sequences vectors system hashtables
kernel.private sbufs growable assocs namespaces quotations
math strings combinators ;
: (each-object) ( quot: ( obj -- ) -- )
[ next-object dup ] swap [ drop ] while ; inline
: each-object ( quot -- )
begin-scan (each-object) end-scan ; inline
begin-scan [ (each-object) ] [ end-scan ] [ ] cleanup ; inline
: instances ( quot -- seq )
pusher >r each-object r> >array ; inline
pusher [ each-object ] dip >array ; inline
: save ( -- ) image save-image ;