Fix inspector problem with empty hashtables

darcs
slava 2006-02-03 18:20:22 +00:00
parent d84a4cc497
commit e9f73af344
3 changed files with 12 additions and 5 deletions

View File

@ -13,3 +13,4 @@ V{ } clone inspector-stack set
f (inspect) f (inspect)
\ + (inspect) \ + (inspect)
H{ } (inspect) H{ } (inspect)
H{ } describe

View File

@ -78,8 +78,12 @@ M: word summary ( word -- )
DEFER: describe DEFER: describe
: sheet. ( sheet -- ) : sheet. ( sheet -- )
dup empty? [
drop
] [
dup format-sheet swap peek dup format-sheet swap peek
[ dup [ describe ] curry simple-outliner terpri ] 2each ; [ dup [ describe ] curry simple-outliner terpri ] 2each
] if ;
: describe ( object -- ) dup summary print sheet sheet. ; : describe ( object -- ) dup summary print sheet sheet. ;

View File

@ -8,8 +8,10 @@ prettyprint sequences words ;
SYMBOL: inspector-slots SYMBOL: inspector-slots
: sheet-numbers ( sheet -- sheet ) : sheet-numbers ( sheet -- sheet )
dup empty? [
dup first length >array 1array swap append dup first length >array 1array swap append
dup peek inspector-slots set ; dup peek inspector-slots set
] unless ;
SYMBOL: inspector-stack SYMBOL: inspector-stack
@ -18,7 +20,7 @@ SYMBOL: inspector-stack
: (inspect) ( obj -- ) : (inspect) ( obj -- )
dup inspector-stack get push dup inspector-stack get push
dup summary print dup summary print
sheet dup empty? [ drop ] [ sheet-numbers sheet. ] if ; sheet sheet-numbers sheet. ;
: inspector-help ( -- ) : inspector-help ( -- )
"Object inspector." print "Object inspector." print