Compiler warnings are no more
parent
c074c2c93b
commit
5649cc7a0a
|
@ -68,9 +68,11 @@ SYMBOL: bootstrap-time
|
|||
"staging" get "deploy-vocab" get or [
|
||||
"stage2: deployment mode" print
|
||||
] [
|
||||
"listener" require
|
||||
"debugger" require
|
||||
"alien.prettyprint" require
|
||||
"inspector" require
|
||||
"tools.errors" require
|
||||
"listener" require
|
||||
"none" require
|
||||
] if
|
||||
|
||||
|
|
|
@ -375,45 +375,21 @@ M: long-long-type flatten-value-type ( type -- types )
|
|||
: box-return* ( node -- )
|
||||
return>> [ ] [ box-return ] if-void ;
|
||||
|
||||
TUPLE: no-such-library name ;
|
||||
|
||||
M: no-such-library summary
|
||||
drop "Library not found" ;
|
||||
|
||||
M: no-such-library error-type drop +linkage-error+ ;
|
||||
|
||||
: no-such-library ( name -- )
|
||||
\ no-such-library boa
|
||||
compiling-word get compiler-error ;
|
||||
|
||||
TUPLE: no-such-symbol name ;
|
||||
|
||||
M: no-such-symbol summary
|
||||
drop "Symbol not found" ;
|
||||
|
||||
M: no-such-symbol error-type drop +linkage-error+ ;
|
||||
|
||||
: no-such-symbol ( name -- )
|
||||
\ no-such-symbol boa
|
||||
compiling-word get compiler-error ;
|
||||
|
||||
: check-dlsym ( symbols dll -- )
|
||||
dup dll-valid? [
|
||||
dupd '[ _ dlsym ] any?
|
||||
[ drop ] [ no-such-symbol ] if
|
||||
[ drop ] [ compiling-word get no-such-symbol ] if
|
||||
] [
|
||||
dll-path no-such-library drop
|
||||
dll-path compiling-word get no-such-library drop
|
||||
] if ;
|
||||
|
||||
: stdcall-mangle ( symbol node -- symbol )
|
||||
"@"
|
||||
swap parameters>> parameter-sizes drop
|
||||
number>string 3append ;
|
||||
: stdcall-mangle ( symbol params -- symbol )
|
||||
parameters>> parameter-sizes drop number>string "@" glue ;
|
||||
|
||||
: alien-invoke-dlsym ( params -- symbols dll )
|
||||
dup function>> dup pick stdcall-mangle 2array
|
||||
swap library>> library dup [ dll>> ] when
|
||||
2dup check-dlsym ;
|
||||
[ [ function>> dup ] keep stdcall-mangle 2array ]
|
||||
[ library>> library dup [ dll>> ] when ]
|
||||
bi 2dup check-dlsym ;
|
||||
|
||||
M: ##alien-invoke generate-insn
|
||||
params>>
|
||||
|
|
|
@ -29,7 +29,7 @@ $nl
|
|||
$nl
|
||||
"The " { $link compile-word } " word performs the actual task of compiling an individual word. The process proceeds as follows:"
|
||||
{ $list
|
||||
{ "The " { $link frontend } " word calls " { $link build-tree } ". If this fails, the error is passed to " { $link deoptimize } ". The logic for ignoring compile warnings generated for inline words and macros is located here. If the error is not ignorable, it is added to the global " { $link compiler-errors } " assoc (see " { $link "compiler-errors" } ")." }
|
||||
{ "The " { $link frontend } " word calls " { $link build-tree } ". If this fails, the error is passed to " { $link deoptimize } ". The logic for ignoring certain compile errors generated for inline words and macros is located here. If the error is not ignorable, it is added to the global " { $link compiler-errors } " assoc (see " { $link "compiler-errors" } ")." }
|
||||
{ "If the word contains a breakpoint, compilation ends here. Otherwise, all remaining steps execute until machine code is generated. Any further errors thrown by the compiler are not reported as compile errors, but instead are ordinary exceptions. This is because they indicate bugs in the compiler, not errors in user code." }
|
||||
{ "The " { $link frontend } " word then calls " { $link optimize-tree } ". This produces the final optimized tree IR, and this stage of the compiler is complete." }
|
||||
{ "The " { $link backend } " word calls " { $link build-cfg } " followed by " { $link optimize-cfg } " and a few other stages. Finally, it calls " { $link save-asm } ", and adds any uncompiled words called by this word to the compilation queue with " { $link compile-dependency } "." }
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors kernel namespaces arrays sequences io words fry
|
||||
continuations vocabs assocs dlists definitions math graphs generic
|
||||
combinators deques search-deques macros io source-files.errors stack-checker
|
||||
stack-checker.state stack-checker.inlining combinators.short-circuit
|
||||
compiler.errors compiler.units compiler.tree.builder
|
||||
compiler.tree.optimizer compiler.cfg.builder compiler.cfg.optimizer
|
||||
compiler.cfg.linearization compiler.cfg.two-operand
|
||||
compiler.cfg.linear-scan compiler.cfg.stack-frame compiler.codegen
|
||||
compiler.utilities ;
|
||||
combinators deques search-deques macros io source-files.errors
|
||||
stack-checker stack-checker.state stack-checker.inlining
|
||||
stack-checker.errors combinators.short-circuit compiler.errors
|
||||
compiler.units compiler.tree.builder compiler.tree.optimizer
|
||||
compiler.cfg.builder compiler.cfg.optimizer compiler.cfg.linearization
|
||||
compiler.cfg.two-operand compiler.cfg.linear-scan
|
||||
compiler.cfg.stack-frame compiler.codegen compiler.utilities ;
|
||||
IN: compiler
|
||||
|
||||
SYMBOL: compile-queue
|
||||
|
@ -39,10 +39,10 @@ SYMBOL: compiled
|
|||
"trace-compilation" get [ dup name>> print flush ] when
|
||||
H{ } clone dependencies set
|
||||
H{ } clone generic-dependencies set
|
||||
f swap compiler-error ;
|
||||
clear-compiler-error ;
|
||||
|
||||
: ignore-error? ( word error -- ? )
|
||||
#! Ignore warnings on inline combinators, macros, and special
|
||||
#! Ignore some errors on inline combinators, macros, and special
|
||||
#! words such as 'call'.
|
||||
[
|
||||
{
|
||||
|
@ -51,7 +51,12 @@ SYMBOL: compiled
|
|||
[ "special" word-prop ]
|
||||
[ "no-compile" word-prop ]
|
||||
} 1||
|
||||
] [ error-type +compiler-warning+ eq? ] bi* and ;
|
||||
] [
|
||||
{
|
||||
[ do-not-compile? ]
|
||||
[ literal-expected? ]
|
||||
} 1||
|
||||
] bi* and ;
|
||||
|
||||
: finish ( word -- )
|
||||
#! Recompile callers if the word's stack effect changed, then
|
||||
|
@ -80,10 +85,16 @@ SYMBOL: compiled
|
|||
#! non-optimizing compiler, using its definition. Otherwise,
|
||||
#! if the compiler error is not ignorable, use a dummy
|
||||
#! definition from 'not-compiled-def' which throws an error.
|
||||
2dup ignore-error?
|
||||
[ drop f over def>> ]
|
||||
[ 2dup not-compiled-def ] if
|
||||
[ swap compiler-error ] [ deoptimize-with ] bi-curry* bi ;
|
||||
2dup ignore-error? [
|
||||
drop
|
||||
[ dup def>> deoptimize-with ]
|
||||
[ clear-compiler-error ]
|
||||
bi
|
||||
] [
|
||||
[ swap <compiler-error> compiler-error ]
|
||||
[ [ drop ] [ not-compiled-def ] 2bi deoptimize-with ]
|
||||
2bi
|
||||
] if ;
|
||||
|
||||
: frontend ( word -- nodes )
|
||||
#! If the word contains breakpoints, don't optimize it, since
|
||||
|
|
|
@ -1,56 +1,72 @@
|
|||
! Copyright (C) 2007, 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors source-files.errors kernel namespaces assocs ;
|
||||
USING: accessors source-files.errors kernel namespaces assocs fry
|
||||
summary ;
|
||||
IN: compiler.errors
|
||||
|
||||
TUPLE: compiler-error < source-file-error ;
|
||||
|
||||
M: compiler-error error-type error>> error-type ;
|
||||
|
||||
SYMBOL: +compiler-error+
|
||||
SYMBOL: compiler-errors
|
||||
|
||||
compiler-errors [ H{ } clone ] initialize
|
||||
|
||||
SYMBOLS: +compiler-error+ +compiler-warning+ +linkage-error+ ;
|
||||
TUPLE: compiler-error < source-file-error ;
|
||||
|
||||
: errors-of-type ( type -- assoc )
|
||||
compiler-errors get-global
|
||||
swap [ [ nip error-type ] dip eq? ] curry
|
||||
assoc-filter ;
|
||||
M: compiler-error error-type drop +compiler-error+ ;
|
||||
|
||||
SYMBOL: +linkage-error+
|
||||
SYMBOL: linkage-errors
|
||||
|
||||
linkage-errors [ H{ } clone ] initialize
|
||||
|
||||
TUPLE: linkage-error < source-file-error ;
|
||||
|
||||
M: linkage-error error-type drop +linkage-error+ ;
|
||||
|
||||
: clear-compiler-error ( word -- )
|
||||
compiler-errors linkage-errors
|
||||
[ get-global delete-at ] bi-curry@ bi ;
|
||||
|
||||
: compiler-error ( error -- )
|
||||
dup asset>> compiler-errors get-global set-at ;
|
||||
|
||||
T{ error-type
|
||||
{ type +compiler-error+ }
|
||||
{ word ":errors" }
|
||||
{ plural "compiler errors" }
|
||||
{ icon "vocab:ui/tools/error-list/icons/compiler-error.tiff" }
|
||||
{ quot [ +compiler-error+ errors-of-type values ] }
|
||||
{ quot [ compiler-errors get values ] }
|
||||
{ forget-quot [ compiler-errors get delete-at ] }
|
||||
} define-error-type
|
||||
|
||||
T{ error-type
|
||||
{ type +compiler-warning+ }
|
||||
{ word ":warnings" }
|
||||
{ plural "compiler warnings" }
|
||||
{ icon "vocab:ui/tools/error-list/icons/compiler-warning.tiff" }
|
||||
{ quot [ +compiler-warning+ errors-of-type values ] }
|
||||
{ forget-quot [ compiler-errors get delete-at ] }
|
||||
} define-error-type
|
||||
: <compiler-error> ( error word -- compiler-error )
|
||||
\ compiler-error <definition-error> ;
|
||||
|
||||
: <linkage-error> ( error word -- linkage-error )
|
||||
\ linkage-error <definition-error> ;
|
||||
|
||||
: linkage-error ( error word class -- )
|
||||
'[ _ boa ] dip <linkage-error> dup asset>> linkage-errors get set-at ; inline
|
||||
|
||||
T{ error-type
|
||||
{ type +linkage-error+ }
|
||||
{ word ":linkage" }
|
||||
{ plural "linkage errors" }
|
||||
{ icon "vocab:ui/tools/error-list/icons/linkage-error.tiff" }
|
||||
{ quot [ +linkage-error+ errors-of-type values ] }
|
||||
{ forget-quot [ compiler-errors get delete-at ] }
|
||||
{ quot [ linkage-errors get values ] }
|
||||
{ forget-quot [ linkage-errors get delete-at ] }
|
||||
{ fatal? f }
|
||||
} define-error-type
|
||||
|
||||
: <compiler-error> ( error word -- compiler-error )
|
||||
\ compiler-error <definition-error> ;
|
||||
TUPLE: no-such-library name ;
|
||||
|
||||
: compiler-error ( error word -- )
|
||||
compiler-errors get-global pick
|
||||
[ [ [ <compiler-error> ] keep ] dip set-at ] [ delete-at drop ] if ;
|
||||
M: no-such-library summary drop "Library not found" ;
|
||||
|
||||
: no-such-library ( name word -- ) \ no-such-library linkage-error ;
|
||||
|
||||
TUPLE: no-such-symbol name ;
|
||||
|
||||
M: no-such-symbol summary drop "Symbol not found" ;
|
||||
|
||||
: no-such-symbol ( name word -- ) \ no-such-symbol linkage-error ;
|
||||
|
||||
ERROR: not-compiled word error ;
|
|
@ -15,7 +15,7 @@ IN: compiler.tree.builder
|
|||
|
||||
GENERIC: (build-tree) ( quot -- )
|
||||
|
||||
M: callable (build-tree) f initial-recursive-state infer-quot ;
|
||||
M: callable (build-tree) infer-quot-here ;
|
||||
|
||||
: check-no-compile ( word -- )
|
||||
dup "no-compile" word-prop [ do-not-compile ] [ drop ] if ;
|
||||
|
@ -31,15 +31,13 @@ M: callable (build-tree) f initial-recursive-state infer-quot ;
|
|||
dup inline-recursive? [ 1quotation ] [ specialized-def ] if ;
|
||||
|
||||
M: word (build-tree)
|
||||
{
|
||||
[ initial-recursive-state recursive-state set ]
|
||||
[ check-no-compile ]
|
||||
[ word-body infer-quot-here ]
|
||||
[ current-effect check-effect ]
|
||||
} cleave ;
|
||||
[ check-no-compile ]
|
||||
[ word-body infer-quot-here ]
|
||||
[ current-effect check-effect ] tri ;
|
||||
|
||||
: build-tree-with ( in-stack word/quot -- nodes )
|
||||
[
|
||||
<recursive-state> recursive-state set
|
||||
V{ } clone stack-visitor set
|
||||
[ [ >vector \ meta-d set ] [ length d-in set ] bi ]
|
||||
[ (build-tree) ]
|
||||
|
|
|
@ -101,8 +101,6 @@ $nl
|
|||
{ $subsection recursive-quotation-error }
|
||||
{ $subsection too-many->r }
|
||||
{ $subsection too-many-r> }
|
||||
{ $subsection missing-effect }
|
||||
"Main wrapper for all inference warnings and errors:"
|
||||
{ $subsection inference-error } ;
|
||||
{ $subsection missing-effect } ;
|
||||
|
||||
ABOUT: "inference-errors"
|
||||
|
|
|
@ -1,93 +1,36 @@
|
|||
! Copyright (C) 2006, 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel generic sequences io words arrays summary effects
|
||||
continuations assocs accessors namespaces compiler.errors
|
||||
stack-checker.values stack-checker.recursive-state
|
||||
source-files.errors compiler.errors ;
|
||||
USING: kernel stack-checker.values ;
|
||||
IN: stack-checker.errors
|
||||
|
||||
: pretty-word ( word -- word' )
|
||||
dup method-body? [ "method-generic" word-prop ] when ;
|
||||
TUPLE: inference-error ;
|
||||
|
||||
TUPLE: inference-error error type word ;
|
||||
ERROR: do-not-compile < inference-error word ;
|
||||
|
||||
M: inference-error error-type type>> ;
|
||||
ERROR: literal-expected < inference-error what ;
|
||||
|
||||
: (inference-error) ( ... class type -- * )
|
||||
[ boa ] dip
|
||||
recursive-state get word>>
|
||||
\ inference-error boa rethrow ; inline
|
||||
ERROR: unbalanced-branches-error < inference-error branches quots ;
|
||||
|
||||
: inference-error ( ... class -- * )
|
||||
+compiler-error+ (inference-error) ; inline
|
||||
ERROR: too-many->r < inference-error ;
|
||||
|
||||
: inference-warning ( ... class -- * )
|
||||
+compiler-warning+ (inference-error) ; inline
|
||||
ERROR: too-many-r> < inference-error ;
|
||||
|
||||
TUPLE: do-not-compile word ;
|
||||
ERROR: missing-effect < inference-error word ;
|
||||
|
||||
: do-not-compile ( word -- * ) \ do-not-compile inference-warning ;
|
||||
ERROR: effect-error < inference-error inferred declared ;
|
||||
|
||||
TUPLE: literal-expected what ;
|
||||
ERROR: recursive-quotation-error < inference-error quot ;
|
||||
|
||||
: literal-expected ( what -- * ) \ literal-expected inference-warning ;
|
||||
ERROR: undeclared-recursion-error < inference-error word ;
|
||||
|
||||
M: object (literal) "literal value" literal-expected ;
|
||||
ERROR: diverging-recursion-error < inference-error word ;
|
||||
|
||||
TUPLE: unbalanced-branches-error branches quots ;
|
||||
ERROR: unbalanced-recursion-error < inference-error word height ;
|
||||
|
||||
: unbalanced-branches-error ( branches quots -- * )
|
||||
\ unbalanced-branches-error inference-error ;
|
||||
ERROR: inconsistent-recursive-call-error < inference-error word ;
|
||||
|
||||
TUPLE: too-many->r ;
|
||||
ERROR: unknown-primitive-error < inference-error ;
|
||||
|
||||
: too-many->r ( -- * ) \ too-many->r inference-error ;
|
||||
ERROR: transform-expansion-error < inference-error word error ;
|
||||
|
||||
TUPLE: too-many-r> ;
|
||||
|
||||
: too-many-r> ( -- * ) \ too-many-r> inference-error ;
|
||||
|
||||
TUPLE: missing-effect word ;
|
||||
|
||||
: missing-effect ( word -- * )
|
||||
pretty-word \ missing-effect inference-error ;
|
||||
|
||||
TUPLE: effect-error inferred declared ;
|
||||
|
||||
: effect-error ( inferred declared -- * )
|
||||
\ effect-error inference-error ;
|
||||
|
||||
TUPLE: recursive-quotation-error quot ;
|
||||
|
||||
: recursive-quotation-error ( word -- * )
|
||||
\ recursive-quotation-error inference-error ;
|
||||
|
||||
TUPLE: undeclared-recursion-error word ;
|
||||
|
||||
: undeclared-recursion-error ( word -- * )
|
||||
\ undeclared-recursion-error inference-error ;
|
||||
|
||||
TUPLE: diverging-recursion-error word ;
|
||||
|
||||
: diverging-recursion-error ( word -- * )
|
||||
\ diverging-recursion-error inference-error ;
|
||||
|
||||
TUPLE: unbalanced-recursion-error word height ;
|
||||
|
||||
: unbalanced-recursion-error ( word height -- * )
|
||||
\ unbalanced-recursion-error inference-error ;
|
||||
|
||||
TUPLE: inconsistent-recursive-call-error word ;
|
||||
|
||||
: inconsistent-recursive-call-error ( word -- * )
|
||||
\ inconsistent-recursive-call-error inference-error ;
|
||||
|
||||
TUPLE: unknown-primitive-error ;
|
||||
|
||||
: unknown-primitive-error ( -- * )
|
||||
\ unknown-primitive-error inference-warning ;
|
||||
|
||||
TUPLE: transform-expansion-error word error ;
|
||||
|
||||
: transform-expansion-error ( word error -- * )
|
||||
\ transform-expansion-error inference-error ;
|
||||
M: object (literal) "literal value" literal-expected ;
|
|
@ -1,18 +1,11 @@
|
|||
! Copyright (C) 2008, 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors kernel prettyprint io debugger
|
||||
sequences assocs stack-checker.errors summary effects make ;
|
||||
sequences assocs stack-checker.errors summary effects ;
|
||||
IN: stack-checker.errors.prettyprint
|
||||
|
||||
M: inference-error summary error>> summary ;
|
||||
|
||||
M: inference-error error-help error>> error-help ;
|
||||
|
||||
M: inference-error error.
|
||||
[ word>> [ "In word: " write . ] when* ] [ error>> error. ] bi ;
|
||||
|
||||
M: literal-expected summary
|
||||
[ "Got a computed value where a " % what>> % " was expected" % ] "" make ;
|
||||
what>> "Got a computed value where a " " was expected" surround ;
|
||||
|
||||
M: literal-expected error. summary print ;
|
||||
|
||||
|
@ -25,63 +18,45 @@ M: unbalanced-branches-error error.
|
|||
[ [ first pprint-short bl ] [ second effect>string print ] bi ] each ;
|
||||
|
||||
M: too-many->r summary
|
||||
drop
|
||||
"Quotation pushes elements on retain stack without popping them" ;
|
||||
drop "Quotation pushes elements on retain stack without popping them" ;
|
||||
|
||||
M: too-many-r> summary
|
||||
drop
|
||||
"Quotation pops retain stack elements which it did not push" ;
|
||||
drop "Quotation pops retain stack elements which it did not push" ;
|
||||
|
||||
M: missing-effect summary
|
||||
[
|
||||
"The word " %
|
||||
word>> name>> %
|
||||
" must declare a stack effect" %
|
||||
] "" make ;
|
||||
drop "Missing stack effect declaration" ;
|
||||
|
||||
M: effect-error summary
|
||||
drop "Stack effect declaration is wrong" ;
|
||||
|
||||
M: recursive-quotation-error error.
|
||||
"The quotation " write
|
||||
quot>> pprint
|
||||
" calls itself." print
|
||||
"Stack effect inference is undecidable when quotation-level recursion is permitted." print ;
|
||||
M: recursive-quotation-error summary
|
||||
drop "Recursive quotation" ;
|
||||
|
||||
M: undeclared-recursion-error summary
|
||||
drop
|
||||
"Inline recursive words must be declared recursive" ;
|
||||
word>> name>>
|
||||
"The inline recursive word " " must be declared recursive" surround ;
|
||||
|
||||
M: diverging-recursion-error summary
|
||||
[
|
||||
"The recursive word " %
|
||||
word>> name>> %
|
||||
" digs arbitrarily deep into the stack" %
|
||||
] "" make ;
|
||||
word>> name>>
|
||||
"The recursive word " " digs arbitrarily deep into the stack" surround ;
|
||||
|
||||
M: unbalanced-recursion-error summary
|
||||
[
|
||||
"The recursive word " %
|
||||
word>> name>> %
|
||||
" leaves with the stack having the wrong height" %
|
||||
] "" make ;
|
||||
word>> name>>
|
||||
"The recursive word " " leaves with the stack having the wrong height" surround ;
|
||||
|
||||
M: inconsistent-recursive-call-error summary
|
||||
[
|
||||
"The recursive word " %
|
||||
word>> name>> %
|
||||
" calls itself with a different set of quotation parameters than were input" %
|
||||
] "" make ;
|
||||
word>> name>>
|
||||
"The recursive word "
|
||||
" calls itself with a different set of quotation parameters than were input" surround ;
|
||||
|
||||
M: unknown-primitive-error summary
|
||||
drop
|
||||
"Cannot determine stack effect statically" ;
|
||||
word>> name>> "The " " word cannot be called from optimized words" surround ;
|
||||
|
||||
M: transform-expansion-error summary
|
||||
drop
|
||||
"Compiler transform threw an error" ;
|
||||
word>> name>> "Macro expansion of " " threw an error" surround ;
|
||||
|
||||
M: transform-expansion-error error.
|
||||
[ summary print ]
|
||||
[ "Word: " write word>> . nl ]
|
||||
[ error>> error. ] tri ;
|
||||
[ summary print ] [ error>> error. ] bi ;
|
||||
|
||||
M: do-not-compile summary
|
||||
word>> name>> "Cannot compile call to " prepend ;
|
|
@ -1,25 +1,19 @@
|
|||
! Copyright (C) 2008, 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays sequences kernel sequences assocs
|
||||
namespaces stack-checker.recursive-state.tree ;
|
||||
USING: accessors kernel namespaces stack-checker.recursive-state.tree ;
|
||||
IN: stack-checker.recursive-state
|
||||
|
||||
TUPLE: recursive-state word quotations inline-words ;
|
||||
TUPLE: recursive-state quotations inline-words ;
|
||||
|
||||
: initial-recursive-state ( word -- state )
|
||||
recursive-state new
|
||||
swap >>word
|
||||
f >>quotations
|
||||
f >>inline-words ; inline
|
||||
: <recursive-state> ( -- state ) recursive-state new ; inline
|
||||
|
||||
f initial-recursive-state recursive-state set-global
|
||||
<recursive-state> recursive-state set-global
|
||||
|
||||
: add-local-quotation ( rstate quot -- rstate )
|
||||
swap clone [ dupd store ] change-quotations ;
|
||||
|
||||
: add-inline-word ( word label -- rstate )
|
||||
swap recursive-state get clone
|
||||
[ store ] change-inline-words ;
|
||||
swap recursive-state get clone [ store ] change-inline-words ;
|
||||
|
||||
: inline-recursive-label ( word -- label/f )
|
||||
recursive-state get inline-words>> lookup ;
|
||||
|
|
|
@ -2,34 +2,33 @@ IN: tools.errors
|
|||
USING: help.markup help.syntax source-files.errors words io
|
||||
compiler.errors ;
|
||||
|
||||
ARTICLE: "compiler-errors" "Compiler warnings and errors"
|
||||
"After loading a vocabulary, you might see messages like:"
|
||||
ARTICLE: "compiler-errors" "Compiler errors"
|
||||
"After loading a vocabulary, you might see a message like:"
|
||||
{ $code
|
||||
":errors - print 2 compiler errors"
|
||||
":warnings - print 1 compiler warnings"
|
||||
}
|
||||
"This indicates that some words did not pass the stack checker. Stack checker error conditions are documented in " { $link "inference-errors" } ", and the stack checker itself in " { $link "inference" } "."
|
||||
$nl
|
||||
"Words to view warnings and errors:"
|
||||
{ $subsection :warnings }
|
||||
"Words to view errors:"
|
||||
{ $subsection :errors }
|
||||
{ $subsection :linkage }
|
||||
"Compiler warnings and errors are reported using the " { $link "tools.errors" } " mechanism, and as a result, they are also are shown in the " { $link "ui.tools.error-list" } "." ;
|
||||
"Compiler errors are reported using the " { $link "tools.errors" } " mechanism, and as a result, they are also are shown in the " { $link "ui.tools.error-list" } "." ;
|
||||
|
||||
HELP: compiler-error
|
||||
{ $values { "error" "an error" } { "word" word } }
|
||||
{ $description "Saves the error for future persual via " { $link :errors } ", " { $link :warnings } " and " { $link :linkage } "." } ;
|
||||
{ $values { "error" compiler-error } { "word" word } }
|
||||
{ $description "Saves the error for viewing with " { $link :errors } "." } ;
|
||||
|
||||
HELP: linkage-error
|
||||
{ $values { "error" linkage-error } { "word" word } }
|
||||
{ $description "Saves the error for viewing with " { $link :linkage } "." } ;
|
||||
|
||||
HELP: :errors
|
||||
{ $description "Prints all serious compiler errors from the most recent compile to " { $link output-stream } "." } ;
|
||||
|
||||
HELP: :warnings
|
||||
{ $description "Prints all ignorable compiler warnings from the most recent compile to " { $link output-stream } "." } ;
|
||||
{ $description "Prints all compiler errors." } ;
|
||||
|
||||
HELP: :linkage
|
||||
{ $description "Prints all C library interface linkage errors from the most recent compile to " { $link output-stream } "." } ;
|
||||
{ $description "Prints all C library interface linkage errors." } ;
|
||||
|
||||
{ :errors :warnings :linkage } related-words
|
||||
{ :errors :linkage } related-words
|
||||
|
||||
HELP: errors.
|
||||
{ $values { "errors" "a sequence of " { $link source-file-error } " instances" } }
|
||||
|
|
|
@ -2,17 +2,15 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: assocs debugger io kernel sequences source-files.errors
|
||||
summary accessors continuations make math.parser io.styles namespaces
|
||||
compiler.errors ;
|
||||
compiler.errors prettyprint ;
|
||||
IN: tools.errors
|
||||
|
||||
#! Tools for source-files.errors. Used by tools.tests and others
|
||||
#! for error reporting
|
||||
|
||||
M: source-file-error compute-restarts
|
||||
error>> compute-restarts ;
|
||||
M: source-file-error compute-restarts error>> compute-restarts ;
|
||||
|
||||
M: source-file-error error-help
|
||||
error>> error-help ;
|
||||
M: source-file-error error-help error>> error-help ;
|
||||
|
||||
CONSTANT: +listener-input+ "<Listener input>"
|
||||
|
||||
|
@ -20,11 +18,13 @@ M: source-file-error summary
|
|||
[
|
||||
[ file>> [ % ": " % ] [ +listener-input+ % ] if* ]
|
||||
[ line#>> [ # ] when* ] bi
|
||||
] "" make
|
||||
;
|
||||
] "" make ;
|
||||
|
||||
M: source-file-error error.
|
||||
[ summary print nl ] [ error>> error. ] bi ;
|
||||
[ summary print nl ]
|
||||
[ "Asset: " write asset>> short. nl ]
|
||||
[ error>> error. ]
|
||||
tri ;
|
||||
|
||||
: errors. ( errors -- )
|
||||
group-by-source-file sort-errors
|
||||
|
@ -34,14 +34,9 @@ M: source-file-error error.
|
|||
bi*
|
||||
] assoc-each ;
|
||||
|
||||
: compiler-errors. ( type -- )
|
||||
errors-of-type values errors. ;
|
||||
: :errors ( -- ) compiler-errors get values errors. ;
|
||||
|
||||
: :errors ( -- ) +compiler-error+ compiler-errors. ;
|
||||
|
||||
: :warnings ( -- ) +compiler-warning+ compiler-errors. ;
|
||||
|
||||
: :linkage ( -- ) +linkage-error+ compiler-errors. ;
|
||||
: :linkage ( -- ) linkage-errors get values errors. ;
|
||||
|
||||
M: not-compiled summary
|
||||
word>> name>> "The word " " cannot be executed because it failed to compile" surround ;
|
||||
|
|
|
@ -8,13 +8,12 @@ $nl
|
|||
{ $heading "Message icons" }
|
||||
{ $table
|
||||
{ "Icon" "Message type" "Reference" }
|
||||
{ { $image "vocab:ui/tools/error-list/icons/note.tiff" } "Parser note" { $link "parser" } }
|
||||
{ { $image "vocab:ui/tools/error-list/icons/syntax-error.tiff" } "Syntax error" { $link "syntax" } }
|
||||
{ { $image "vocab:ui/tools/error-list/icons/compiler-warning.tiff" } "Compiler warning" { $link "compiler-errors" } }
|
||||
! { { $image "vocab:ui/tools/error-list/icons/note.tiff" } "Parser note" { $link "parser" } }
|
||||
! { { $image "vocab:ui/tools/error-list/icons/syntax-error.tiff" } "Syntax error" { $link "syntax" } }
|
||||
{ { $image "vocab:ui/tools/error-list/icons/compiler-error.tiff" } "Compiler error" { $link "compiler-errors" } }
|
||||
{ { $image "vocab:ui/tools/error-list/icons/linkage-error.tiff" } "Linkage error" { $link "loading-libs" } }
|
||||
{ { $image "vocab:ui/tools/error-list/icons/unit-test-error.tiff" } "Unit test failure" { $link "tools.test" } }
|
||||
{ { $image "vocab:ui/tools/error-list/icons/help-lint-error.tiff" } "Help lint failure" { $link "help.lint" } }
|
||||
{ { $image "vocab:ui/tools/error-list/icons/linkage-error.tiff" } "Linkage error" { $link "loading-libs" } }
|
||||
} ;
|
||||
|
||||
ABOUT: "ui.tools.error-list"
|
||||
|
|
Binary file not shown.
|
@ -110,7 +110,7 @@ HELP: save-location
|
|||
{ $description "Saves the location of a definition and associates this definition with the current source file." } ;
|
||||
|
||||
HELP: parser-notes
|
||||
{ $var-description "A boolean controlling whether the parser will print various notes and warnings. Switched on by default. If a source file is being run for its effect on " { $link output-stream } ", this variable should be switched off, to prevent parser notes from polluting the output." } ;
|
||||
{ $var-description "A boolean controlling whether the parser will print various notes. Switched on by default. If a source file is being run for its effect on " { $link output-stream } ", this variable should be switched off, to prevent parser notes from polluting the output." } ;
|
||||
|
||||
HELP: parser-notes?
|
||||
{ $values { "?" "a boolean" } }
|
||||
|
@ -260,7 +260,7 @@ HELP: forget-smudged
|
|||
|
||||
HELP: finish-parsing
|
||||
{ $values { "lines" "the lines of text just parsed" } { "quot" "the quotation just parsed" } }
|
||||
{ $description "Records information to the current " { $link file } " and prints warnings about any removed definitions which are still in use." }
|
||||
{ $description "Records information to the current " { $link file } "." }
|
||||
{ $notes "This is one of the factors of " { $link parse-stream } "." } ;
|
||||
|
||||
HELP: parse-stream
|
||||
|
|
|
@ -93,7 +93,7 @@ IN: mason.report
|
|||
load-everything-errors-file
|
||||
error-dump
|
||||
|
||||
"Compiler warnings and errors"
|
||||
"Compiler errors"
|
||||
compiler-errors-file
|
||||
compiler-error-messages-file
|
||||
error-dump
|
||||
|
|
Loading…
Reference in New Issue