]> gitweb.factorcode.org Git - factor.git/commitdiff
Better handling of errors without file/line info
authorSlava Pestov <slava@shill.local>
Mon, 13 Apr 2009 22:19:32 +0000 (17:19 -0500)
committerSlava Pestov <slava@shill.local>
Mon, 13 Apr 2009 22:19:32 +0000 (17:19 -0500)
basis/editors/editors.factor
basis/tools/walker/walker.factor
basis/ui/tools/error-list/error-list.factor
core/generic/standard/engines/tuple/tuple.factor
core/source-files/errors/errors.factor

index 9aed3ed8c00b5b2830c0c74f11c203e408357987..6088400bd8e41d422675d403fa3c61477b103d16 100644 (file)
@@ -82,7 +82,7 @@ M: object error-line
     error get (:edit) ;
 
 : edit-error ( error -- )
-    [ file>> ] [ line#>> ] bi edit-location ;
+    [ file>> ] [ line#>> ] bi 2dup and [ edit-location ] [ 2drop ] if ;
 
 : edit-each ( seq -- )
     [
index 83a4f196e9e6a1e3e9a72c56749f02bcbb9d1ae8..e6cdc36fe1314b7f3fdd9c9b293f3d107ee6ecd8 100644 (file)
@@ -92,7 +92,7 @@ M: object add-breakpoint ;
 : (step-into-call-next-method) ( method -- )
     next-method-quot (step-into-quot) ;
 
-{
+<< {
     (step-into-quot)
     (step-into-dip)
     (step-into-2dip)
@@ -102,7 +102,7 @@ M: object add-breakpoint ;
     (step-into-execute)
     (step-into-continuation)
     (step-into-call-next-method)
-} [ t "no-compile" set-word-prop ] each
+} [ t "no-compile" set-word-prop ] each >>
 
 ! Messages sent to walker thread
 SYMBOL: step
index ceb5ff092129a7c9f1944084c826f097a7b2bdb5..666801b3617096e8bb7aa8212be03300b6afd085 100644 (file)
@@ -37,14 +37,17 @@ error-toggle source-file-table error-table error-display ;
 SINGLETON: source-file-renderer
 
 M: source-file-renderer row-columns
-    drop first2
-    [ [ source-file-icon ] [ ] [ length number>string ] tri* ] output>array ;
+    drop first2 [
+        [ source-file-icon ]
+        [ "<Listener input>" or ]
+        [ length number>string ] tri*
+    ] output>array ;
 
 M: source-file-renderer prototype-row
     drop source-file-icon "" "" 3array ;
 
 M: source-file-renderer row-value
-    drop dup [ first <pathname> ] when ;
+    drop dup [ first [ <pathname> ] [ f ] if* ] when ;
 
 M: source-file-renderer column-titles
     drop { "" "File" "Errors" } ;
@@ -76,7 +79,7 @@ M: error-renderer row-columns
     drop [
         {
             [ error-type error-icon ]
-            [ line#>> number>string ]
+            [ line#>> [ number>string ] [ "" ] if* ]
             [ asset>> unparse-short ]
             [ error>> summary ]
         } cleave
@@ -96,9 +99,12 @@ M: error-renderer column-alignment drop { 0 1 0 0 } ;
 : sort-errors ( seq -- seq' )
     [ [ [ file>> ] [ line#>> ] bi 2array ] compare ] sort ;
 
+: file-matches? ( error pathname/f -- ? )
+    [ file>> ] [ dup [ string>> ] when ] bi* = ;
+
 : <error-table-model> ( error-list -- model )
     [ model>> ] [ source-file>> ] bi
-    [ [ file>> ] [ string>> ] bi* = ] <search>
+    [ file-matches? ] <search>
     [ sort-errors ] <arrow> ;
 
 :: <error-table> ( error-list -- table )
index c88bd9d97ed1b9cf3fe4bda5ec45ce15eaa3e4be..7e91adfaa191e5155daeb47dca0a803b4edf6b7b 100644 (file)
@@ -82,6 +82,8 @@ M: engine-word stack-effect
         effect boa
     ] [ 2drop f ] if ;
 
+M: engine-word where "tuple-dispatch-generic" word-prop where ;
+
 M: engine-word crossref? "forgotten" word-prop not ;
 
 M: engine-word irrelevant? drop t ;
index 880472bc0a4173748ad74ccbb0e7eeb5b63417bb..ec0dbc0ddd5215ecd02585c21563d544c86f309b 100644 (file)
@@ -20,10 +20,7 @@ GENERIC: error-type ( error -- type )
     new
         swap
         [ >>asset ]
-        [
-            where [ first2 ] [ "<unknown file>" 0 ] if*
-            [ >>file ] [ >>line# ] bi*
-        ] bi
+        [ where [ first2 [ >>file ] [ >>line# ] bi* ] when* ] bi
         swap >>error ; inline
 
 : delete-file-errors ( seq file type -- )
@@ -42,8 +39,11 @@ error-types [ V{ } clone ] initialize
 : error-icon-path ( type -- icon )
     error-types get at icon>> ;
 
+: error-counts ( -- alist )
+    error-types get [ nip dup quot>> call( -- seq ) length ] assoc-map ;
+
 : error-summary ( -- )
-    error-types get [ nip dup quot>> call( -- seq ) length ] assoc-map
+    error-counts
     [ nip 0 > ] assoc-filter
     [
         over