From e9f73af344458a470e4588fa4fe0e57c1e790aff Mon Sep 17 00:00:00 2001 From: slava Date: Fri, 3 Feb 2006 18:20:22 +0000 Subject: [PATCH] Fix inspector problem with empty hashtables --- library/test/inspector.factor | 1 + library/tools/describe.factor | 8 ++++++-- library/tools/inspector.factor | 8 +++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/library/test/inspector.factor b/library/test/inspector.factor index ed5017d3b8..089f1479d0 100644 --- a/library/test/inspector.factor +++ b/library/test/inspector.factor @@ -13,3 +13,4 @@ V{ } clone inspector-stack set f (inspect) \ + (inspect) H{ } (inspect) +H{ } describe diff --git a/library/tools/describe.factor b/library/tools/describe.factor index 9a28cbfdc1..19c40adb90 100644 --- a/library/tools/describe.factor +++ b/library/tools/describe.factor @@ -78,8 +78,12 @@ M: word summary ( word -- ) DEFER: describe : sheet. ( sheet -- ) - dup format-sheet swap peek - [ dup [ describe ] curry simple-outliner terpri ] 2each ; + dup empty? [ + drop + ] [ + dup format-sheet swap peek + [ dup [ describe ] curry simple-outliner terpri ] 2each + ] if ; : describe ( object -- ) dup summary print sheet sheet. ; diff --git a/library/tools/inspector.factor b/library/tools/inspector.factor index b41c3d0e6f..c7ac43e8d3 100644 --- a/library/tools/inspector.factor +++ b/library/tools/inspector.factor @@ -8,8 +8,10 @@ prettyprint sequences words ; SYMBOL: inspector-slots : sheet-numbers ( sheet -- sheet ) - dup first length >array 1array swap append - dup peek inspector-slots set ; + dup empty? [ + dup first length >array 1array swap append + dup peek inspector-slots set + ] unless ; SYMBOL: inspector-stack @@ -18,7 +20,7 @@ SYMBOL: inspector-stack : (inspect) ( obj -- ) dup inspector-stack get push dup summary print - sheet dup empty? [ drop ] [ sheet-numbers sheet. ] if ; + sheet sheet-numbers sheet. ; : inspector-help ( -- ) "Object inspector." print