words: Fix compile errors in unit tests, remove ?word-name word and replace its usages with present

db4
Slava Pestov 2009-03-22 17:53:06 -05:00
parent 2f4e2735ea
commit 0ffc9247cc
5 changed files with 18 additions and 21 deletions

View File

@ -4,7 +4,7 @@ USING: accessors arrays definitions generic io kernel assocs
hashtables namespaces make parser prettyprint sequences strings hashtables namespaces make parser prettyprint sequences strings
io.styles vectors words math sorting splitting classes slots fry io.styles vectors words math sorting splitting classes slots fry
sets vocabs help.stylesheet help.topics vocabs.loader quotations sets vocabs help.stylesheet help.topics vocabs.loader quotations
combinators see ; combinators see present ;
IN: help.markup IN: help.markup
PREDICATE: simple-element < array PREDICATE: simple-element < array
@ -276,7 +276,7 @@ M: f ($instance)
$snippet ; $snippet ;
: values-row ( seq -- seq ) : values-row ( seq -- seq )
unclip \ $snippet swap ?word-name 2array unclip \ $snippet swap present 2array
swap dup first word? [ \ $instance prefix ] when 2array ; swap dup first word? [ \ $instance prefix ] when 2array ;
: $values ( element -- ) : $values ( element -- )

View File

@ -50,8 +50,8 @@ SYMBOL: a-symbol
! See if redefining a generic as a colon def clears some ! See if redefining a generic as a colon def clears some
! word props. ! word props.
GENERIC: testing GENERIC: testing ( a -- b )
"IN: words.tests : testing ;" eval "IN: words.tests : testing ( -- ) ;" eval
[ f ] [ \ testing generic? ] unit-test [ f ] [ \ testing generic? ] unit-test
@ -106,7 +106,7 @@ DEFER: calls-a-gensym
! regression ! regression
GENERIC: freakish ( x -- y ) GENERIC: freakish ( x -- y )
: bar freakish ; : bar ( x -- y ) freakish ;
M: array freakish ; M: array freakish ;
[ t ] [ \ bar \ freakish usage member? ] unit-test [ t ] [ \ bar \ freakish usage member? ] unit-test
@ -116,7 +116,7 @@ DEFER: x
[ ] [ "no-loc" "words.tests" create drop ] unit-test [ ] [ "no-loc" "words.tests" create drop ] unit-test
[ f ] [ "no-loc" "words.tests" lookup where ] unit-test [ f ] [ "no-loc" "words.tests" lookup where ] unit-test
[ ] [ "IN: words.tests : no-loc-2 ;" eval ] unit-test [ ] [ "IN: words.tests : no-loc-2 ( -- ) ;" eval ] unit-test
[ f ] [ "no-loc-2" "words.tests" lookup where ] unit-test [ f ] [ "no-loc-2" "words.tests" lookup where ] unit-test
[ ] [ "IN: words.tests : test-last ( -- ) ;" eval ] unit-test [ ] [ "IN: words.tests : test-last ( -- ) ;" eval ] unit-test
@ -146,11 +146,11 @@ SYMBOL: quot-uses-b
[ forget ] with-compilation-unit [ forget ] with-compilation-unit
] when* ] when*
[ "IN: words.tests : undef-test ; << undef-test >>" eval ] [ "IN: words.tests : undef-test ( -- ) ; << undef-test >>" eval ]
[ error>> undefined? ] must-fail-with [ error>> undefined? ] must-fail-with
[ ] [ [ ] [
"IN: words.tests GENERIC: symbol-generic" eval "IN: words.tests GENERIC: symbol-generic ( -- )" eval
] unit-test ] unit-test
[ ] [ [ ] [
@ -161,7 +161,7 @@ SYMBOL: quot-uses-b
[ f ] [ "symbol-generic" "words.tests" lookup generic? ] unit-test [ f ] [ "symbol-generic" "words.tests" lookup generic? ] unit-test
[ ] [ [ ] [
"IN: words.tests GENERIC: symbol-generic" <string-reader> "IN: words.tests GENERIC: symbol-generic ( a -- b )" <string-reader>
"symbol-generic-test" parse-stream drop "symbol-generic-test" parse-stream drop
] unit-test ] unit-test
@ -174,14 +174,14 @@ SYMBOL: quot-uses-b
[ f ] [ "symbol-generic" "words.tests" lookup generic? ] unit-test [ f ] [ "symbol-generic" "words.tests" lookup generic? ] unit-test
! Regressions ! Regressions
[ ] [ "IN: words.tests : decl-forget-test ; foldable" eval ] unit-test [ ] [ "IN: words.tests : decl-forget-test ( -- ) ; foldable" eval ] unit-test
[ t ] [ "decl-forget-test" "words.tests" lookup "foldable" word-prop ] unit-test [ t ] [ "decl-forget-test" "words.tests" lookup "foldable" word-prop ] unit-test
[ ] [ "IN: words.tests : decl-forget-test ;" eval ] unit-test [ ] [ "IN: words.tests : decl-forget-test ( -- ) ;" eval ] unit-test
[ f ] [ "decl-forget-test" "words.tests" lookup "foldable" word-prop ] unit-test [ f ] [ "decl-forget-test" "words.tests" lookup "foldable" word-prop ] unit-test
[ ] [ "IN: words.tests : decl-forget-test ; flushable" eval ] unit-test [ ] [ "IN: words.tests : decl-forget-test ( -- ) ; flushable" eval ] unit-test
[ t ] [ "decl-forget-test" "words.tests" lookup "flushable" word-prop ] unit-test [ t ] [ "decl-forget-test" "words.tests" lookup "flushable" word-prop ] unit-test
[ ] [ "IN: words.tests : decl-forget-test ;" eval ] unit-test [ ] [ "IN: words.tests : decl-forget-test ( -- ) ;" eval ] unit-test
[ f ] [ "decl-forget-test" "words.tests" lookup "flushable" word-prop ] unit-test [ f ] [ "decl-forget-test" "words.tests" lookup "flushable" word-prop ] unit-test
[ { } ] [ { } ]

View File

@ -169,8 +169,7 @@ CONSTANT: reset-on-redefine { "inferred-effect" "cannot-infer" }
] if ; ] if ;
: define-declared ( word def effect -- ) : define-declared ( word def effect -- )
pick swap "declared-effect" set-word-prop [ nip swap set-stack-effect ] [ drop define ] 3bi ;
define ;
: make-inline ( word -- ) : make-inline ( word -- )
t "inline" set-word-prop ; t "inline" set-word-prop ;
@ -258,6 +257,4 @@ M: word hashcode*
M: word literalize <wrapper> ; M: word literalize <wrapper> ;
: ?word-name ( word -- name ) dup word? [ name>> ] when ;
: xref-words ( -- ) all-words [ xref ] each ; : xref-words ( -- ) all-words [ xref ] each ;

View File

@ -6,7 +6,7 @@
USING: arrays kernel sequences io io.files io.backend USING: arrays kernel sequences io io.files io.backend
io.encodings.ascii math.parser vocabs definitions io.encodings.ascii math.parser vocabs definitions
namespaces make words sorting ; namespaces make words sorting present ;
IN: ctags IN: ctags
: ctag-word ( ctag -- word ) : ctag-word ( ctag -- word )
@ -20,7 +20,7 @@ IN: ctags
: ctag ( seq -- str ) : ctag ( seq -- str )
[ [
dup ctag-word ?word-name % dup ctag-word present %
"\t" % "\t" %
dup ctag-path normalize-path % dup ctag-path normalize-path %
"\t" % "\t" %

View File

@ -5,7 +5,7 @@
! Alfredo Beaumont <alfredo.beaumont@gmail.com> ! Alfredo Beaumont <alfredo.beaumont@gmail.com>
USING: kernel sequences sorting assocs words prettyprint ctags USING: kernel sequences sorting assocs words prettyprint ctags
io.encodings.ascii io.files math math.parser namespaces make io.encodings.ascii io.files math math.parser namespaces make
strings shuffle io.backend arrays ; strings shuffle io.backend arrays present ;
IN: ctags.etags IN: ctags.etags
: etag-at ( key hash -- vector ) : etag-at ( key hash -- vector )
@ -36,7 +36,7 @@ IN: ctags.etags
: etag ( lines seq -- str ) : etag ( lines seq -- str )
[ [
dup first ?word-name % dup first present %
1 HEX: 7f <string> % 1 HEX: 7f <string> %
second dup number>string % second dup number>string %
1 CHAR: , <string> % 1 CHAR: , <string> %