Fix dodgy method overloading

db4
Slava Pestov 2008-08-31 05:19:16 -05:00
parent f37546a5e7
commit 5792783760
3 changed files with 19 additions and 22 deletions

View File

@ -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

View File

@ -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

View File

@ -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