]> gitweb.factorcode.org Git - factor.git/commitdiff
core: Don't use with-scope. H{ } clone [ ] with-variables is the same thing and is...
authorDoug Coleman <doug.coleman@gmail.com>
Thu, 3 Mar 2016 01:18:42 +0000 (17:18 -0800)
committerDoug Coleman <doug.coleman@gmail.com>
Thu, 3 Mar 2016 01:18:42 +0000 (17:18 -0800)
core/compiler/units/units.factor
core/continuations/continuations-tests.factor
core/destructors/destructors.factor
core/io/pathnames/pathnames-tests.factor
core/source-files/source-files.factor
core/vectors/vectors-tests.factor
core/words/words-tests.factor

index 1dd6726c20936cd25d44ce13f897f3c2e17a6a4e..d42fe860d61f21454ecf7e5994bca64e9906dde7 100644 (file)
@@ -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 -- )
-    [
-        <definitions> new-definitions set
-        <definitions> old-definitions set
-        HS{ } clone forgotten-definitions set
+    H{ } clone
+    <definitions> new-definitions pick set-at
+    <definitions> old-definitions pick set-at
+    HS{ } clone forgotten-definitions pick set-at [
         with-nested-compilation-unit
-    ] with-scope ; inline
+    ] with-variables ; inline
index a3c31b45adc8cc3345e34231bdfe02a6023e1d8e..1d16b6a14155ba8d8a6d47fc97f63a9cf4b8f2d9 100644 (file)
@@ -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
 
index 3e4eaeeec992c44ea31b19221d1d0d221e25e633..2cb758344efcb1d2a0487c52d29828ad98f17856 100755 (executable)
@@ -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
index 617debee6905b9d34cd22afb07c028e6e7a90816..75574b58dec0bd043e52a87b9bfa843cea763214 100644 (file)
@@ -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
 
index 415ea711eb934b40b54fc0d06661608f42daaa6a..c7bf21c34bb1eadcb95fff6ef04ab83e4608ad8c 100644 (file)
@@ -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
index 7a7442fe10a11afc45a59eb7ac4ef329a39e3fb0..8bec970377b1f3140ed964d32bc60df0f055bf38 100644 (file)
@@ -81,10 +81,9 @@ IN: vectors.tests
 ] unit-test
 
 { 0 } [
-    [
-        10 <vector> "x" set
+    10 <vector> "x" [
         "x" get clone length
-    ] with-scope
+    ] with-variable
 ] unit-test
 
 { f } [ 5 V{ } index ] unit-test
index 98cf9dc5e0e096e9c47c77086e8aa0c5e2f2ca8a..0ca6b62936b4e01062949ca1282e2497cefbe197 100644 (file)
@@ -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>>