]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix dodgy method overloading
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 31 Aug 2008 10:19:16 +0000 (05:19 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 31 Aug 2008 10:19:16 +0000 (05:19 -0500)
core/compiler/units/units.factor
core/definitions/definitions.factor
core/sorting/sorting-tests.factor

index 78799287f58e02ed8852ddc9605998df2b75aa90..fa29a5a519111b38d6b980abb76ebc0fd7e90f67 100755 (executable)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 USING: accessors arrays kernel continuations assocs namespaces
 sequences words vocabs definitions hashtables init sets
-math.order classes classes.algebra ;
+math math.order classes classes.algebra ;
 IN: compiler.units
 
 SYMBOL: old-definitions
@@ -73,11 +73,20 @@ GENERIC: definitions-changed ( assoc obj -- )
 SYMBOL: outdated-tuples
 SYMBOL: update-tuples-hook
 
+: dependency>= ( how1 how2 -- ? )
+    [
+        {
+            called-dependency
+            flushed-dependency
+            inlined-dependency
+        } index
+    ] bi@ >= ;
+
 : strongest-dependency ( how1 how2 -- how )
-    [ called-dependency or ] bi@ max ;
+    [ called-dependency or ] bi@ [ dependency>= ] most ;
 
 : weakest-dependency ( how1 how2 -- how )
-    [ inlined-dependency or ] bi@ min ;
+    [ inlined-dependency or ] bi@ [ dependency>= not ] most ;
 
 : compiled-usage ( word -- assoc )
     compiled-crossref get at ;
@@ -89,7 +98,7 @@ SYMBOL: update-tuples-hook
     #! don't have to recompile words that folded this away.
     [ compiled-usage ]
     [ "flushable" word-prop inlined-dependency flushed-dependency ? ] bi
-    [ after=? nip ] curry assoc-filter ;
+    [ dependency>= nip ] curry assoc-filter ;
 
 : compiled-usages ( assoc -- assocs )
     [ drop word? ] assoc-filter
index d9e9732488b8733dbe3ade9e45415cc1dc219bd8..2b8646fda442795994ba6ef604864a2bcec4b02f 100755 (executable)
@@ -5,23 +5,9 @@ USING: kernel sequences namespaces assocs graphs math math.order ;
 
 ERROR: no-compilation-unit definition ;
 
-SINGLETON: inlined-dependency
-SINGLETON: flushed-dependency
-SINGLETON: called-dependency
-
-UNION: dependency
-inlined-dependency
-flushed-dependency
-called-dependency ;
-
-M: dependency <=>
-    [
-        {
-            called-dependency
-            flushed-dependency
-            inlined-dependency
-        } index
-    ] bi@ <=> ;
+SYMBOL: inlined-dependency
+SYMBOL: flushed-dependency
+SYMBOL: called-dependency
 
 SYMBOL: changed-definitions
 
index 63e193c89fd13fc6babe39e70e22a53588312bed..74cbe3b532a109964aaf54bd5a79d85961faf245 100755 (executable)
@@ -1,5 +1,5 @@
 USING: sorting sequences kernel math math.order random
-tools.test vectors sets ;
+tools.test vectors sets vocabs ;
 IN: sorting.tests
 
 [ { } ] [ { } natural-sort ] unit-test
@@ -24,3 +24,5 @@ unit-test
 
 [ { { 1 "a" } { 1 "b" } { 1 "c" } { 1 "e" } { 2 "d" } } ]
 [ { { 1 "a" } { 1 "b" } { 1 "c" } { 2 "d" } { 1 "e" } } sort-keys ] unit-test
+
+[ ] [ all-words natural-sort drop ] unit-test