Remove annoying and useless shadowing warnings
parent
225a0fb781
commit
fcb78822b2
core/parser
|
@ -284,10 +284,6 @@ HELP: use
|
||||||
HELP: in
|
HELP: in
|
||||||
{ $var-description "A variable holding the name of the current vocabulary for new definitions." } ;
|
{ $var-description "A variable holding the name of the current vocabulary for new definitions." } ;
|
||||||
|
|
||||||
HELP: shadow-warnings
|
|
||||||
{ $values { "vocab" "an assoc mapping strings to words" } { "vocabs" "a sequence of assocs" } }
|
|
||||||
{ $description "Tests if any keys in " { $snippet "vocab" } " shadow keys in the elements of " { $snippet "vocabs" } ", and if so, prints a warning message. These warning messages can be disabled by setting " { $link parser-notes } " to " { $link f } "." } ;
|
|
||||||
|
|
||||||
HELP: (use+)
|
HELP: (use+)
|
||||||
{ $values { "vocab" "an assoc mapping strings to words" } }
|
{ $values { "vocab" "an assoc mapping strings to words" } }
|
||||||
{ $description "Adds an assoc at the front of the search path." }
|
{ $description "Adds an assoc at the front of the search path." }
|
||||||
|
|
|
@ -191,22 +191,8 @@ SYMBOL: in
|
||||||
: word/vocab% ( word -- )
|
: word/vocab% ( word -- )
|
||||||
"(" % dup word-vocabulary % " " % word-name % ")" % ;
|
"(" % dup word-vocabulary % " " % word-name % ")" % ;
|
||||||
|
|
||||||
: shadow-warning ( new old -- )
|
|
||||||
2dup eq? [
|
|
||||||
2drop
|
|
||||||
] [
|
|
||||||
[ word/vocab% " shadowed by " % word/vocab% ] "" make
|
|
||||||
note.
|
|
||||||
] if ;
|
|
||||||
|
|
||||||
: shadow-warnings ( vocab vocabs -- )
|
|
||||||
[
|
|
||||||
swapd assoc-stack dup
|
|
||||||
[ shadow-warning ] [ 2drop ] if
|
|
||||||
] curry assoc-each ;
|
|
||||||
|
|
||||||
: (use+) ( vocab -- )
|
: (use+) ( vocab -- )
|
||||||
vocab-words use get 2dup shadow-warnings push ;
|
vocab-words use get push ;
|
||||||
|
|
||||||
: use+ ( vocab -- )
|
: use+ ( vocab -- )
|
||||||
load-vocab (use+) ;
|
load-vocab (use+) ;
|
||||||
|
|
Loading…
Reference in New Issue