From: Slava Pestov Date: Tue, 3 Jan 2012 05:18:52 +0000 (-0600) Subject: Set up listener's manifest so that words defined in "scratchpad" take precedence... X-Git-Tag: 0.97~3241 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=d1b6106011b8ba8450888e62084a39b173b63da1 Set up listener's manifest so that words defined in "scratchpad" take precedence over other vocabularies and do not raise a restart. This matches the behavior of IN: and USE: in files, where the IN: takes precedence. Also remove unused clear-manifest word. Fixes #407 --- diff --git a/basis/listener/listener-tests.factor b/basis/listener/listener-tests.factor index 907c45360d..4a97996637 100644 --- a/basis/listener/listener-tests.factor +++ b/basis/listener/listener-tests.factor @@ -1,6 +1,6 @@ USING: io io.streams.string io.streams.duplex listener tools.test parser math namespaces continuations vocabs kernel -compiler.units eval vocabs.parser ; +compiler.units eval vocabs.parser words definitions ; IN: listener.tests SYNTAX: hello "Hi" print ; @@ -52,3 +52,16 @@ SYNTAX: hello "Hi" print ; drop ] unit-test ] with-file-vocabs + +[ "call" "scratchpad" create drop ] with-compilation-unit + +[ + [ t ] + [ + "call" "scratchpad" lookup-word + [ "call" search ] with-interactive-vocabs + eq? + ] unit-test +] with-file-vocabs + +[ "call" "scratchpad" lookup-word forget ] with-compilation-unit diff --git a/basis/listener/listener.factor b/basis/listener/listener.factor index 740b739c42..59ddff1f75 100644 --- a/basis/listener/listener.factor +++ b/basis/listener/listener.factor @@ -185,11 +185,9 @@ SYMBOL: interactive-vocabs "vocabs.refresh" "vocabs.hierarchy" "words" - "scratchpad" } interactive-vocabs set-global -: only-use-vocabs ( vocabs -- ) - clear-manifest +: use-loaded-vocabs ( vocabs -- ) [ lookup-vocab ] filter [ lookup-vocab @@ -201,7 +199,7 @@ SYMBOL: interactive-vocabs : with-interactive-vocabs ( quot -- ) [ "scratchpad" set-current-vocab - interactive-vocabs get only-use-vocabs + interactive-vocabs get use-loaded-vocabs call ] with-manifest ; inline diff --git a/core/vocabs/parser/parser.factor b/core/vocabs/parser/parser.factor index 0259482686..d0a625b5ae 100644 --- a/core/vocabs/parser/parser.factor +++ b/core/vocabs/parser/parser.factor @@ -49,13 +49,6 @@ M: extra-words equal? C: extra-words -: clear-manifest ( -- ) - manifest get - [ search-vocab-names>> clear-assoc ] - [ search-vocabs>> delete-all ] - [ qualified-vocabs>> delete-all ] - tri ; - ERROR: no-word-in-vocab word vocab ;