Merge branch 'master' of git@github.com:seckar/factor into autouse-existing-usings
commit
ca853d5eac
|
@ -0,0 +1,33 @@
|
|||
! Copyright (C) 2009 Nicholas Seckar.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: continuations eval fuel fuel.private namespaces tools.test words ;
|
||||
IN: fuel.tests
|
||||
|
||||
: fake-continuation ( -- continuation )
|
||||
f f f "fake" f <continuation> ;
|
||||
|
||||
: make-uses-restart ( -- restart )
|
||||
"Use the words vocabulary" \ word?
|
||||
fake-continuation <restart> ;
|
||||
|
||||
: make-defer-restart ( -- restart )
|
||||
"Defer word in current vocabulary" f
|
||||
fake-continuation <restart> ;
|
||||
|
||||
{ f } [ make-defer-restart is-use-restart ] unit-test
|
||||
{ t } [ make-uses-restart is-use-restart ] unit-test
|
||||
|
||||
{ "words" } [ make-uses-restart get-restart-vocab ] unit-test
|
||||
|
||||
{ f } [ make-defer-restart is-suggested-restart ] unit-test
|
||||
{ f } [ make-uses-restart is-suggested-restart ] unit-test
|
||||
{ f } [ { "io" } :uses-suggestions
|
||||
[ make-uses-restart is-suggested-restart ] with-variable
|
||||
] unit-test
|
||||
{ t } [ { "words" } :uses-suggestions
|
||||
[ make-uses-restart is-suggested-restart ] with-variable
|
||||
] unit-test
|
||||
|
||||
{ } [
|
||||
{ "kernel" } [ "\\ dup drop" eval( -- ) ] fuel-use-suggested-vocabs
|
||||
] unit-test
|
|
@ -2,8 +2,8 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
|
||||
USING: accessors assocs compiler.units continuations fuel.eval fuel.help
|
||||
fuel.remote fuel.xref help.topics io.pathnames kernel math namespaces parser
|
||||
sequences tools.scaffold vocabs.loader ;
|
||||
fuel.remote fuel.xref help.topics io.pathnames kernel namespaces parser
|
||||
sequences tools.scaffold vocabs.loader words ;
|
||||
|
||||
IN: fuel
|
||||
|
||||
|
@ -33,10 +33,8 @@ SYMBOL: :uses-suggestions
|
|||
: is-use-restart ( restart -- ? )
|
||||
name>> [ "Use the " head? ] [ " vocabulary" tail? ] bi and ;
|
||||
|
||||
: get-restart-vocab ( restart -- vocab )
|
||||
[ "Use the " length ] dip
|
||||
name>> [ length " vocabulary" length - ] keep
|
||||
subseq ;
|
||||
: get-restart-vocab ( restart -- vocab/f )
|
||||
obj>> dup word? [ vocabulary>> ] [ drop f ] if ;
|
||||
|
||||
: is-suggested-restart ( restart -- ? )
|
||||
dup is-use-restart [
|
||||
|
@ -56,9 +54,9 @@ SYMBOL: :uses-suggestions
|
|||
|
||||
PRIVATE>
|
||||
|
||||
: fuel-use-suggested-vocabs ( ... suggestions quot: ( ... -- ... ) -- ... )
|
||||
: fuel-use-suggested-vocabs ( suggestions quot ... suggestions quot: ( ... -- ... ) -- ... )
|
||||
[ :uses-suggestions set ] dip
|
||||
[ try-suggested-restarts rethrow ] recover ;
|
||||
[ try-suggested-restarts rethrow ] recover ; inline
|
||||
|
||||
: fuel-run-file ( path -- )
|
||||
[ fuel-set-use-hook run-file ] curry with-scope ; inline
|
||||
|
|
Loading…
Reference in New Issue