Add fatal? flag to error types; non-fatal errors are hidden by default in error list, not shown in summary

db4
Slava Pestov 2009-04-17 16:16:12 -05:00
parent 99a120a146
commit f80c89f128
4 changed files with 9 additions and 9 deletions

View File

@ -44,6 +44,7 @@ T{ error-type
{ icon "vocab:ui/tools/error-list/icons/linkage-error.tiff" } { icon "vocab:ui/tools/error-list/icons/linkage-error.tiff" }
{ quot [ +linkage-error+ errors-of-type values ] } { quot [ +linkage-error+ errors-of-type values ] }
{ forget-quot [ compiler-errors get delete-at ] } { forget-quot [ compiler-errors get delete-at ] }
{ fatal? f }
} define-error-type } define-error-type
: <compiler-error> ( error word -- compiler-error ) : <compiler-error> ( error word -- compiler-error )

View File

@ -26,7 +26,7 @@ MEMO: error-icon ( type -- image-name )
: <error-toggle> ( -- model gadget ) : <error-toggle> ( -- model gadget )
#! Linkage errors are not shown by default. #! Linkage errors are not shown by default.
error-types get keys [ dup +linkage-error+ eq? not <model> ] { } map>assoc error-types get [ fatal?>> <model> ] assoc-map
[ [ [ error-icon ] dip ] assoc-map <checkboxes> ] [ [ [ error-icon ] dip ] assoc-map <checkboxes> ]
[ <mapping> ] bi ; [ <mapping> ] bi ;

View File

@ -358,9 +358,8 @@ interactor "completion" f {
} define-command-map } define-command-map
: ui-error-summary ( -- ) : ui-error-summary ( -- )
all-errors [ error-counts keys [
[ error-type ] map prune [ icon>> 1array \ $image prefix " " 2array ] { } map-as
[ error-icon-path 1array \ $image prefix " " 2array ] { } map-as
{ "Press " { $command tool "common" show-error-list } " to view errors." } { "Press " { $command tool "common" show-error-list } " to view errors." }
append print-element nl append print-element nl
] unless-empty ; ] unless-empty ;

View File

@ -12,7 +12,7 @@ TUPLE: source-file-error error asset file line# ;
: group-by-source-file ( errors -- assoc ) : group-by-source-file ( errors -- assoc )
H{ } clone [ [ push-at ] curry [ dup file>> ] prepose each ] keep ; H{ } clone [ [ push-at ] curry [ dup file>> ] prepose each ] keep ;
TUPLE: error-type type word plural icon quot forget-quot ; TUPLE: error-type type word plural icon quot forget-quot { fatal? initial: t } ;
GENERIC: error-type ( error -- type ) GENERIC: error-type ( error -- type )
@ -34,12 +34,12 @@ error-types [ V{ } clone ] initialize
error-types get at icon>> ; error-types get at icon>> ;
: error-counts ( -- alist ) : error-counts ( -- alist )
error-types get [ nip dup quot>> call( -- seq ) length ] assoc-map ; error-types get
[ nip dup quot>> call( -- seq ) length ] assoc-map
[ [ fatal?>> ] [ 0 > ] bi* and ] assoc-filter ;
: error-summary ( -- ) : error-summary ( -- )
error-counts error-counts [
[ nip 0 > ] assoc-filter
[
over over
[ word>> write ] [ word>> write ]
[ " - show " write number>string write bl ] [ " - show " write number>string write bl ]