diff --git a/core/compiler/units/units.factor b/core/compiler/units/units.factor index 1dd6726c20..d42fe860d6 100644 --- a/core/compiler/units/units.factor +++ b/core/compiler/units/units.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2008, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs classes classes.private -classes.tuple classes.tuple.private continuations definitions -generic hash-sets init kernel kernel.private math namespaces -sequences sets source-files.errors vocabs words ; +classes.tuple.private continuations definitions generic +hash-sets init kernel kernel.private math namespaces sequences +sets source-files.errors vocabs words ; IN: compiler.units PRIMITIVE: modify-code-heap ( alist update-existing? reset-pics? -- ) @@ -184,24 +184,24 @@ M: nesting-observer definitions-changed PRIVATE> : with-nested-compilation-unit ( quot -- ) - [ - HS{ } clone changed-definitions set - HS{ } clone maybe-changed set - HS{ } clone changed-effects set - HS{ } clone outdated-generics set - H{ } clone outdated-tuples set - HS{ } clone new-words set + H{ } clone + HS{ } clone changed-definitions pick set-at + HS{ } clone maybe-changed pick set-at + HS{ } clone changed-effects pick set-at + HS{ } clone outdated-generics pick set-at + H{ } clone outdated-tuples pick set-at + HS{ } clone new-words pick set-at [ add-nesting-observer [ remove-nesting-observer finish-compilation-unit ] [ ] cleanup - ] with-scope ; inline + ] with-variables ; inline : with-compilation-unit ( quot -- ) - [ - new-definitions set - old-definitions set - HS{ } clone forgotten-definitions set + H{ } clone + new-definitions pick set-at + old-definitions pick set-at + HS{ } clone forgotten-definitions pick set-at [ with-nested-compilation-unit - ] with-scope ; inline + ] with-variables ; inline diff --git a/core/continuations/continuations-tests.factor b/core/continuations/continuations-tests.factor index a3c31b45ad..1d16b6a141 100644 --- a/core/continuations/continuations-tests.factor +++ b/core/continuations/continuations-tests.factor @@ -1,5 +1,6 @@ -USING: accessors arrays continuations debugger eval io kernel kernel.private -math memory namespaces parser sequences system tools.test vectors words ; +USING: accessors continuations debugger eval hashtables io +kernel kernel.private math memory namespaces sequences +tools.test vectors words ; IN: continuations.tests : (callcc1-test) ( n obj -- n' obj ) @@ -15,10 +16,9 @@ IN: continuations.tests : callcc-namespace-test ( -- ? ) [ "test-cc" set - 5 "x" set - [ + 5 "x" [ 6 "x" set "test-cc" get continue - ] with-scope + ] with-variable ] callcc0 "x" get 5 = ; { t } [ 10 callcc1-test 10 iota reverse >vector = ] unit-test @@ -64,9 +64,9 @@ IN: continuations.tests SYMBOL: always-counter SYMBOL: error-counter +0 always-counter +0 error-counter 2hashtable [ - 0 always-counter set - 0 error-counter set [ ] [ always-counter inc ] [ error-counter inc ] cleanup @@ -90,7 +90,7 @@ SYMBOL: error-counter [ 3 ] [ always-counter get ] unit-test [ 1 ] [ error-counter get ] unit-test -] with-scope +] with-variables { } [ [ return ] with-return ] unit-test diff --git a/core/destructors/destructors.factor b/core/destructors/destructors.factor index 3e4eaeeec9..2cb758344e 100755 --- a/core/destructors/destructors.factor +++ b/core/destructors/destructors.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007, 2010 Doug Coleman, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors assocs continuations init kernel make -namespaces sequences sets ; +USING: accessors continuations hashtables init kernel namespaces +sequences sets ; IN: destructors SYMBOL: disposables @@ -82,13 +82,13 @@ PRIVATE> dup error-destructors get push ; inline : with-destructors ( quot -- ) - [ - V{ } clone always-destructors set - V{ } clone error-destructors set + V{ } clone always-destructors + V{ } clone error-destructors + 2hashtable [ [ do-always-destructors ] [ do-error-destructors ] cleanup - ] with-scope ; inline + ] with-variables ; inline [ HS{ } clone disposables set-global diff --git a/core/io/pathnames/pathnames-tests.factor b/core/io/pathnames/pathnames-tests.factor index 617debee69..75574b58de 100644 --- a/core/io/pathnames/pathnames-tests.factor +++ b/core/io/pathnames/pathnames-tests.factor @@ -1,7 +1,6 @@ -USING: io.pathnames io.files.temp io.directories -continuations math io.files.private kernel -namespaces sequences system tools.test -io.backend io.pathnames.private ; +USING: continuations hashtables io.backend io.directories +io.files.private io.files.temp io.pathnames kernel math +namespaces system tools.test ; IN: io.pathnames.tests { "passwd" } [ "/etc/passwd" file-name ] unit-test @@ -58,13 +57,12 @@ IN: io.pathnames.tests { } [ 2 [ "touch-twice-test" temp-file touch-file ] times ] unit-test ! aum's bug -[ - "." current-directory set - ".." "resource-path" set +"." current-directory +".." "resource-path" 2hashtable [ [ "../core/bootstrap/stage2.factor" ] [ "resource:core/bootstrap/stage2.factor" absolute-path ] unit-test -] with-scope +] with-variables { t } [ cwd "misc" resource-path [ ] with-directory cwd = ] unit-test diff --git a/core/source-files/source-files.factor b/core/source-files/source-files.factor index 415ea711eb..c7bf21c34b 100644 --- a/core/source-files/source-files.factor +++ b/core/source-files/source-files.factor @@ -68,11 +68,11 @@ SYMBOL: current-source-file : with-source-file ( name quot -- ) ! Should be called from inside with-compilation-unit. - [ + H{ } clone source-files [ [ path>source-file [ current-source-file set ] [ definitions>> old-definitions set ] bi ] dip [ wrap-source-file-error ] recover - ] with-scope ; inline + ] with-variable ; inline diff --git a/core/vectors/vectors-tests.factor b/core/vectors/vectors-tests.factor index 7a7442fe10..8bec970377 100644 --- a/core/vectors/vectors-tests.factor +++ b/core/vectors/vectors-tests.factor @@ -81,10 +81,9 @@ IN: vectors.tests ] unit-test { 0 } [ - [ - 10 "x" set + 10 "x" [ "x" get clone length - ] with-scope + ] with-variable ] unit-test { f } [ 5 V{ } index ] unit-test diff --git a/core/words/words-tests.factor b/core/words/words-tests.factor index 98cf9dc5e0..0ca6b62936 100644 --- a/core/words/words-tests.factor +++ b/core/words/words-tests.factor @@ -31,11 +31,11 @@ DEFER: plist-test "create-test" "scratchpad" lookup-word "testing" word-prop ] unit-test -[ +H{ } clone [ [ t ] [ \ array? "array?" "arrays" lookup-word = ] unit-test [ ] [ [ "test-scope" "scratchpad" create-word drop ] with-compilation-unit ] unit-test -] with-scope +] with-variables { "test-scope" } [ "test-scope" "scratchpad" lookup-word name>>