From 013adec055910f99ee7d66fe4e6c2a18893faa5c Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 25 Oct 2017 10:45:46 -0700 Subject: [PATCH] source-files.errors: rename to new-source-file-error. --- basis/compiler/errors/errors.factor | 4 ++-- basis/help/lint/lint.factor | 2 +- basis/tools/deprecation/deprecation.factor | 21 +++++++++++---------- basis/tools/errors/errors-docs.factor | 2 +- core/source-files/errors/errors-docs.factor | 8 ++++---- core/source-files/errors/errors.factor | 14 +++++++------- 6 files changed, 26 insertions(+), 25 deletions(-) diff --git a/basis/compiler/errors/errors.factor b/basis/compiler/errors/errors.factor index 2c61621762..41c2af320f 100644 --- a/basis/compiler/errors/errors.factor +++ b/basis/compiler/errors/errors.factor @@ -39,10 +39,10 @@ T{ error-type-holder } define-error-type : ( error word -- compiler-error ) - \ compiler-error ; + compiler-error new-source-file-error ; : ( error word -- linkage-error ) - \ linkage-error ; + linkage-error new-source-file-error ; : set-linkage-error ( name message word class -- ) '[ _ boa ] dip dup asset>> linkage-errors get set-at ; inline diff --git a/basis/help/lint/lint.factor b/basis/help/lint/lint.factor index 66988df5aa..95a2f7e0d0 100644 --- a/basis/help/lint/lint.factor +++ b/basis/help/lint/lint.factor @@ -28,7 +28,7 @@ M: help-lint-error error-type drop +help-lint-failure+ ; ( error topic -- help-lint-error ) - \ help-lint-error ; + help-lint-error new-source-file-error ; PRIVATE> diff --git a/basis/tools/deprecation/deprecation.factor b/basis/tools/deprecation/deprecation.factor index de7fbbb1cc..7b748eaded 100644 --- a/basis/tools/deprecation/deprecation.factor +++ b/basis/tools/deprecation/deprecation.factor @@ -12,9 +12,9 @@ SYMBOL: deprecation-notes deprecation-notes [ H{ } clone ] initialize -TUPLE: deprecation-note-error < source-file-error ; +TUPLE: deprecation-note < source-file-error ; -M: deprecation-note-error error-type drop +deprecation-note+ ; +M: deprecation-note error-type drop +deprecation-note+ ; TUPLE: deprecated-usages asset usages ; @@ -31,13 +31,13 @@ T{ error-type-holder { fatal? f } } define-error-type -: ( error word -- deprecation-note ) - \ deprecation-note-error ; +: ( error word -- deprecation-note ) + deprecation-note new-source-file-error ; -: deprecation-note ( word usages -- ) - [ deprecated-usages boa ] - [ drop ] - [ drop deprecation-notes get-global set-at ] 2tri ; +: store-deprecation-note ( word usages -- ) + over [ deprecated-usages boa ] dip + [ ] + [ deprecation-notes get-global set-at ] bi ; : clear-deprecation-note ( word -- ) deprecation-notes get-global delete-at ; @@ -47,7 +47,8 @@ T{ error-type-holder dup { [ "forgotten" word-prop ] [ deprecated? ] } 1|| [ clear-deprecation-note ] [ dup def>> uses [ deprecated? ] filter - [ clear-deprecation-note ] [ >array deprecation-note ] if-empty + [ clear-deprecation-note ] + [ store-deprecation-note ] if-empty ] if ] [ drop ] if ; @@ -74,7 +75,7 @@ M: deprecation-observer definitions-changed [ [ check-deprecations ] each ] [ drop initialize-deprecation-notes ] if ; -[ \ deprecation-observer add-definition-observer ] +[ deprecation-observer add-definition-observer ] "tools.deprecation" add-startup-hook initialize-deprecation-notes diff --git a/basis/tools/errors/errors-docs.factor b/basis/tools/errors/errors-docs.factor index f52a2c5c13..25f417fa13 100644 --- a/basis/tools/errors/errors-docs.factor +++ b/basis/tools/errors/errors-docs.factor @@ -33,7 +33,7 @@ HELP: :linkage { :errors :linkage } related-words HELP: errors. -{ $values { "errors" "a sequence of " { $link source-file-error } " instances" } } +{ $values { "errors" { $sequence source-file-error } } } { $description "Prints a list of errors, grouped by source file." } ; ARTICLE: "tools.errors" "Batch error reporting" diff --git a/core/source-files/errors/errors-docs.factor b/core/source-files/errors/errors-docs.factor index 17d0094d54..086f814d69 100644 --- a/core/source-files/errors/errors-docs.factor +++ b/core/source-files/errors/errors-docs.factor @@ -32,11 +32,11 @@ HELP: error-file { $values { "error" "an error" } { "file" "a file path" } } { $description "File in which the error occurred." } ; -HELP: +HELP: new-source-file-error { $values - { "error" "an error." } - { "definition" "an asset that contains the error." } - { "class" "a tuple class deriving source-file-error." } + { "error" "an error" } + { "asset" "an asset that contains the error" } + { "class" "a tuple class deriving source-file-error" } { "source-file-error" source-file-error } } { $description "Creates a new " { $link source-file-error } " instance." } ; diff --git a/core/source-files/errors/errors.factor b/core/source-files/errors/errors.factor index 494fc651cf..fd790dcb4c 100644 --- a/core/source-files/errors/errors.factor +++ b/core/source-files/errors/errors.factor @@ -19,6 +19,13 @@ M: source-file-error error-file [ error>> error-file ] [ path>> ] bi or ; M: source-file-error error-line [ error>> error-line ] [ line#>> ] bi or ; M: source-file-error compute-restarts error>> compute-restarts ; +: new-source-file-error ( error asset class -- source-file-error ) + new + swap + [ >>asset ] + [ where [ first2 [ >>path ] [ >>line# ] bi* ] when* ] bi + swap >>error ; inline + : sort-errors ( errors -- alist ) [ [ line#>> 0 or ] sort-with ] { } assoc-map-as sort-keys ; @@ -29,13 +36,6 @@ TUPLE: error-type-holder type word plural icon quot forget-quot { fatal? initial GENERIC: error-type ( error -- type ) -: ( error definition class -- source-file-error ) - new - swap - [ >>asset ] - [ where [ first2 [ >>path ] [ >>line# ] bi* ] when* ] bi - swap >>error ; inline - SYMBOL: error-types error-types [ V{ } clone ] initialize