From 0ffc9247cce245f77724560fd44911d2432e5b26 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 22 Mar 2009 17:53:06 -0500 Subject: [PATCH] words: Fix compile errors in unit tests, remove ?word-name word and replace its usages with present --- basis/help/markup/markup.factor | 4 ++-- core/words/words-tests.factor | 22 +++++++++++----------- core/words/words.factor | 5 +---- extra/ctags/ctags.factor | 4 ++-- extra/ctags/etags/etags.factor | 4 ++-- 5 files changed, 18 insertions(+), 21 deletions(-) diff --git a/basis/help/markup/markup.factor b/basis/help/markup/markup.factor index 8ea36d62fb..a80d386638 100644 --- a/basis/help/markup/markup.factor +++ b/basis/help/markup/markup.factor @@ -4,7 +4,7 @@ USING: accessors arrays definitions generic io kernel assocs hashtables namespaces make parser prettyprint sequences strings io.styles vectors words math sorting splitting classes slots fry sets vocabs help.stylesheet help.topics vocabs.loader quotations -combinators see ; +combinators see present ; IN: help.markup PREDICATE: simple-element < array @@ -276,7 +276,7 @@ M: f ($instance) $snippet ; : values-row ( seq -- seq ) - unclip \ $snippet swap ?word-name 2array + unclip \ $snippet swap present 2array swap dup first word? [ \ $instance prefix ] when 2array ; : $values ( element -- ) diff --git a/core/words/words-tests.factor b/core/words/words-tests.factor index 52a20ba48a..305541119b 100755 --- a/core/words/words-tests.factor +++ b/core/words/words-tests.factor @@ -50,8 +50,8 @@ SYMBOL: a-symbol ! See if redefining a generic as a colon def clears some ! word props. -GENERIC: testing -"IN: words.tests : testing ;" eval +GENERIC: testing ( a -- b ) +"IN: words.tests : testing ( -- ) ;" eval [ f ] [ \ testing generic? ] unit-test @@ -106,7 +106,7 @@ DEFER: calls-a-gensym ! regression GENERIC: freakish ( x -- y ) -: bar freakish ; +: bar ( x -- y ) freakish ; M: array freakish ; [ t ] [ \ bar \ freakish usage member? ] unit-test @@ -116,7 +116,7 @@ DEFER: x [ ] [ "no-loc" "words.tests" create drop ] 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 [ ] [ "IN: words.tests : test-last ( -- ) ;" eval ] unit-test @@ -146,11 +146,11 @@ SYMBOL: quot-uses-b [ forget ] with-compilation-unit ] when* -[ "IN: words.tests : undef-test ; << undef-test >>" eval ] +[ "IN: words.tests : undef-test ( -- ) ; << undef-test >>" eval ] [ error>> undefined? ] must-fail-with [ ] [ - "IN: words.tests GENERIC: symbol-generic" eval + "IN: words.tests GENERIC: symbol-generic ( -- )" eval ] unit-test [ ] [ @@ -161,7 +161,7 @@ SYMBOL: quot-uses-b [ f ] [ "symbol-generic" "words.tests" lookup generic? ] unit-test [ ] [ - "IN: words.tests GENERIC: symbol-generic" + "IN: words.tests GENERIC: symbol-generic ( a -- b )" "symbol-generic-test" parse-stream drop ] unit-test @@ -174,14 +174,14 @@ SYMBOL: quot-uses-b [ f ] [ "symbol-generic" "words.tests" lookup generic? ] unit-test ! 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 -[ ] [ "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 -[ ] [ "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 -[ ] [ "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 [ { } ] diff --git a/core/words/words.factor b/core/words/words.factor index c255c00eae..b101350db0 100755 --- a/core/words/words.factor +++ b/core/words/words.factor @@ -169,8 +169,7 @@ CONSTANT: reset-on-redefine { "inferred-effect" "cannot-infer" } ] if ; : define-declared ( word def effect -- ) - pick swap "declared-effect" set-word-prop - define ; + [ nip swap set-stack-effect ] [ drop define ] 3bi ; : make-inline ( word -- ) t "inline" set-word-prop ; @@ -258,6 +257,4 @@ M: word hashcode* M: word literalize ; -: ?word-name ( word -- name ) dup word? [ name>> ] when ; - : xref-words ( -- ) all-words [ xref ] each ; diff --git a/extra/ctags/ctags.factor b/extra/ctags/ctags.factor index 38160de0e9..393c932482 100644 --- a/extra/ctags/ctags.factor +++ b/extra/ctags/ctags.factor @@ -6,7 +6,7 @@ USING: arrays kernel sequences io io.files io.backend io.encodings.ascii math.parser vocabs definitions -namespaces make words sorting ; +namespaces make words sorting present ; IN: ctags : ctag-word ( ctag -- word ) @@ -20,7 +20,7 @@ IN: ctags : ctag ( seq -- str ) [ - dup ctag-word ?word-name % + dup ctag-word present % "\t" % dup ctag-path normalize-path % "\t" % diff --git a/extra/ctags/etags/etags.factor b/extra/ctags/etags/etags.factor index 9fe63e914e..40c0b791cf 100644 --- a/extra/ctags/etags/etags.factor +++ b/extra/ctags/etags/etags.factor @@ -5,7 +5,7 @@ ! Alfredo Beaumont USING: kernel sequences sorting assocs words prettyprint ctags io.encodings.ascii io.files math math.parser namespaces make -strings shuffle io.backend arrays ; +strings shuffle io.backend arrays present ; IN: ctags.etags : etag-at ( key hash -- vector ) @@ -36,7 +36,7 @@ IN: ctags.etags : etag ( lines seq -- str ) [ - dup first ?word-name % + dup first present % 1 HEX: 7f % second dup number>string % 1 CHAR: , %