tools.errors: fix printing of errors with no associated source file

db4
Slava Pestov 2009-04-22 10:46:50 -05:00
parent 91cd13d2d6
commit cd91b2e755
3 changed files with 29 additions and 7 deletions

View File

@ -0,0 +1,20 @@
USING: compiler.errors stack-checker.errors tools.test words ;
IN: tools.errors
DEFER: blah
[ ] [
{
T{ compiler-error
{ error
T{ inference-error
f
T{ do-not-compile f blah }
+compiler-error+
blah
}
}
{ asset blah }
}
} errors.
] unit-test

View File

@ -14,9 +14,11 @@ M: source-file-error compute-restarts
M: source-file-error error-help M: source-file-error error-help
error>> error-help ; error>> error-help ;
CONSTANT: +listener-input+ "<Listener input>"
M: source-file-error summary M: source-file-error summary
[ [
[ file>> [ % ": " % ] [ "<Listener input>" % ] if* ] [ file>> [ % ": " % ] [ +listener-input+ % ] if* ]
[ line#>> [ # ] when* ] bi [ line#>> [ # ] when* ] bi
] "" make ] "" make
; ;
@ -27,7 +29,7 @@ M: source-file-error error.
: errors. ( errors -- ) : errors. ( errors -- )
group-by-source-file sort-errors group-by-source-file sort-errors
[ [
[ nl "==== " write print nl ] [ nl "==== " write +listener-input+ or print nl ]
[ [ nl ] [ error. ] interleave ] [ [ nl ] [ error. ] interleave ]
bi* bi*
] assoc-each ; ] assoc-each ;

View File

@ -4,14 +4,14 @@ USING: accessors arrays sequences sorting assocs colors.constants fry
combinators combinators.smart combinators.short-circuit editors make combinators combinators.smart combinators.short-circuit editors make
memoize compiler.units fonts kernel io.pathnames prettyprint memoize compiler.units fonts kernel io.pathnames prettyprint
source-files.errors math.parser init math.order models models.arrow source-files.errors math.parser init math.order models models.arrow
models.arrow.smart models.search models.mapping models.delay debugger namespaces models.arrow.smart models.search models.mapping models.delay debugger
summary locals ui ui.commands ui.gadgets ui.gadgets.panes namespaces summary locals ui ui.commands ui.gadgets ui.gadgets.panes
ui.gadgets.tables ui.gadgets.labeled ui.gadgets.tracks ui.gestures ui.gadgets.tables ui.gadgets.labeled ui.gadgets.tracks ui.gestures
ui.operations ui.tools.browser ui.tools.common ui.gadgets.scrollers ui.operations ui.tools.browser ui.tools.common ui.gadgets.scrollers
ui.tools.inspector ui.gadgets.status-bar ui.operations ui.tools.inspector ui.gadgets.status-bar ui.operations
ui.gadgets.buttons ui.gadgets.borders ui.gadgets.packs ui.gadgets.buttons ui.gadgets.borders ui.gadgets.packs
ui.gadgets.labels ui.baseline-alignment ui.images ui.gadgets.labels ui.baseline-alignment ui.images ui.tools.listener
compiler.errors calendar ; compiler.errors calendar tools.errors ;
IN: ui.tools.error-list IN: ui.tools.error-list
CONSTANT: source-file-icon CONSTANT: source-file-icon
@ -39,7 +39,7 @@ SINGLETON: source-file-renderer
M: source-file-renderer row-columns M: source-file-renderer row-columns
drop first2 [ drop first2 [
[ source-file-icon ] [ source-file-icon ]
[ "<Listener input>" or ] [ +listener-input+ or ]
[ length number>string ] tri* [ length number>string ] tri*
] output>array ; ] output>array ;