Finish moving compiler.errors to basis
parent
d227fcd33f
commit
e52be965f0
|
@ -4,7 +4,7 @@ USING: accessors init namespaces words words.symbol io
|
|||
kernel.private math memory continuations kernel io.files
|
||||
io.pathnames io.backend system parser vocabs sequences
|
||||
vocabs.loader combinators splitting source-files strings
|
||||
definitions assocs compiler.errors compiler.units math.parser
|
||||
definitions assocs compiler.units math.parser
|
||||
generic sets command-line ;
|
||||
IN: bootstrap.stage2
|
||||
|
||||
|
|
|
@ -2,4 +2,33 @@ IN: compiler.errors
|
|||
USING: help.markup help.syntax vocabs.loader words io
|
||||
quotations words.symbol ;
|
||||
|
||||
ARTICLE: "compiler-errors" "Compiler warnings and errors"
|
||||
"After loading a vocabulary, you might see messages like:"
|
||||
{ $code
|
||||
":errors - print 2 compiler errors"
|
||||
":warnings - print 50 compiler warnings"
|
||||
}
|
||||
"These messages arise from the compiler's stack effect checker. Production code should not have any warnings and errors in it. Warning and error conditions are documented in " { $link "inference-errors" } "."
|
||||
$nl
|
||||
"Words to view warnings and errors:"
|
||||
{ $subsection :warnings }
|
||||
{ $subsection :errors }
|
||||
{ $subsection :linkage }
|
||||
"Compiler warnings and errors are also 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 } "." } ;
|
||||
|
||||
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 } "." } ;
|
||||
|
||||
HELP: :linkage
|
||||
{ $description "Prints all C library interface linkage errors from the most recent compile to " { $link output-stream } "." } ;
|
||||
|
||||
{ :errors :warnings } related-words
|
||||
|
||||
ABOUT: "compiler-errors"
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
! 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
|
||||
tools.errors ;
|
||||
IN: compiler.errors
|
||||
|
||||
TUPLE: compiler-error < source-file-error ;
|
||||
|
@ -48,3 +49,12 @@ T{ error-type
|
|||
: compiler-error ( error word -- )
|
||||
compiler-errors get-global pick
|
||||
[ [ [ <compiler-error> ] keep ] dip set-at ] [ delete-at drop ] if ;
|
||||
|
||||
: compiler-errors. ( type -- )
|
||||
errors-of-type values errors. ;
|
||||
|
||||
: :errors ( -- ) +compiler-error+ compiler-errors. ;
|
||||
|
||||
: :warnings ( -- ) +compiler-warning+ compiler-errors. ;
|
||||
|
||||
: :linkage ( -- ) +linkage-error+ compiler-errors. ;
|
||||
|
|
|
@ -8,7 +8,7 @@ classes.mixin classes.tuple continuations continuations.private
|
|||
combinators generic.math classes.builtin classes compiler.units
|
||||
generic.standard vocabs init kernel.private io.encodings
|
||||
accessors math.order destructors source-files parser
|
||||
classes.tuple.parser effects.parser lexer compiler.errors
|
||||
classes.tuple.parser effects.parser lexer
|
||||
generic.parser strings.parser vocabs.loader vocabs.parser see
|
||||
source-files.errors ;
|
||||
IN: debugger
|
||||
|
@ -321,8 +321,6 @@ M: source-file-error error.
|
|||
] bi format nl
|
||||
] [ error>> error. ] bi ;
|
||||
|
||||
M: compiler-error summary asset>> summary ;
|
||||
|
||||
M: bad-effect summary
|
||||
drop "Bad stack effect declaration" ;
|
||||
|
||||
|
|
|
@ -1,32 +1 @@
|
|||
IN: tools.errors
|
||||
USING: compiler.errors tools.errors help.markup help.syntax vocabs.loader
|
||||
words quotations io ;
|
||||
|
||||
ARTICLE: "compiler-errors" "Compiler warnings and errors"
|
||||
"After loading a vocabulary, you might see messages like:"
|
||||
{ $code
|
||||
":errors - print 2 compiler errors"
|
||||
":warnings - print 50 compiler warnings"
|
||||
}
|
||||
"These messages arise from the compiler's stack effect checker. Production code should not have any warnings and errors in it. Warning and error conditions are documented in " { $link "inference-errors" } "."
|
||||
$nl
|
||||
"Words to view warnings and errors:"
|
||||
{ $subsection :warnings }
|
||||
{ $subsection :errors }
|
||||
{ $subsection :linkage }
|
||||
"Compiler warnings and errors are also 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 } "." } ;
|
||||
|
||||
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 } "." } ;
|
||||
|
||||
HELP: :linkage
|
||||
{ $description "Prints all C library interface linkage errors from the most recent compile to " { $link output-stream } "." } ;
|
||||
|
||||
{ :errors :warnings } related-words
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
! Copyright (C) 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: assocs compiler.errors debugger io kernel sequences
|
||||
source-files.errors ;
|
||||
USING: assocs debugger io kernel sequences source-files.errors ;
|
||||
IN: tools.errors
|
||||
|
||||
#! Tools for source-files.errors. Used by tools.tests and others
|
||||
|
@ -14,12 +13,3 @@ IN: tools.errors
|
|||
[ [ nl ] [ error. ] interleave ]
|
||||
bi*
|
||||
] assoc-each ;
|
||||
|
||||
: compiler-errors. ( type -- )
|
||||
errors-of-type values errors. ;
|
||||
|
||||
: :errors ( -- ) +compiler-error+ compiler-errors. ;
|
||||
|
||||
: :warnings ( -- ) +compiler-warning+ compiler-errors. ;
|
||||
|
||||
: :linkage ( -- ) +linkage-error+ compiler-errors. ;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: accessors arrays kernel continuations assocs namespaces
|
||||
sequences words vocabs definitions hashtables init sets
|
||||
math math.order classes classes.algebra classes.tuple
|
||||
classes.tuple.private generic compiler.errors ;
|
||||
classes.tuple.private generic ;
|
||||
IN: compiler.units
|
||||
|
||||
SYMBOL: old-definitions
|
||||
|
@ -41,7 +41,7 @@ SYMBOL: compiler-impl
|
|||
HOOK: recompile compiler-impl ( words -- alist )
|
||||
|
||||
! Non-optimizing compiler
|
||||
M: f recompile [ [ f swap compiler-error ] each ] [ [ f ] { } map>assoc ] bi ;
|
||||
M: f recompile [ f ] { } map>assoc ;
|
||||
|
||||
! Trivial compiler. We don't want to touch the code heap
|
||||
! during stage1 bootstrap, it would just waste time.
|
||||
|
|
|
@ -160,6 +160,7 @@ SYMBOL: interactive-vocabs
|
|||
"assocs"
|
||||
"combinators"
|
||||
"compiler"
|
||||
"compiler.errors"
|
||||
"compiler.units"
|
||||
"continuations"
|
||||
"debugger"
|
||||
|
@ -190,7 +191,6 @@ SYMBOL: interactive-vocabs
|
|||
"tools.annotations"
|
||||
"tools.crossref"
|
||||
"tools.disassembler"
|
||||
"tools.errors"
|
||||
"tools.memory"
|
||||
"tools.profiler"
|
||||
"tools.test"
|
||||
|
|
Loading…
Reference in New Issue