]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/compiler/tree/recursive/recursive.factor
use reject instead of [ ... not ] filter.
[factor.git] / basis / compiler / tree / recursive / recursive.factor
index 0473e3a3a4cc602a6c0e7cec50161cc1a96bf1f2..2c65a700b6afca3bace5a94be4a048b0c6d03d0f 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2008, 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel assocs arrays namespaces accessors sequences deques fry
-search-deques dlists combinators.short-circuit make sets compiler.tree ;
+USING: accessors combinators.short-circuit compiler.tree fry
+kernel namespaces sequences sets ;
 FROM: namespaces => set ;
 IN: compiler.tree.recursive
 
@@ -44,7 +44,7 @@ GENERIC: node-call-graph ( tail? node -- )
     ] with-scope ;
 
 M: #return-recursive node-call-graph
-    nip dup label>> (>>return) ;
+    nip dup label>> return<< ;
 
 M: #call-recursive node-call-graph
     [ dup label>> call-site boa ] keep
@@ -61,16 +61,19 @@ M: #recursive node-call-graph
 M: #branch node-call-graph
     children>> [ (build-call-graph) ] with each ;
 
+M: #alien-callback node-call-graph
+    child>> (build-call-graph) ;
+
 M: node node-call-graph 2drop ;
 
 SYMBOLS: not-loops recursive-nesting ;
 
-: not-a-loop ( label -- ) not-loops get conjoin ;
+: not-a-loop ( label -- ) not-loops get adjoin ;
 
-: not-a-loop? ( label -- ? ) not-loops get key? ;
+: not-a-loop? ( label -- ? ) not-loops get in? ;
 
 : non-tail-calls ( call-graph-node -- seq )
-    calls>> [ tail?>> not ] filter ;
+    calls>> [ tail?>> ] reject ;
 
 : visit-back-edges ( call-graph -- )
     [
@@ -109,7 +112,7 @@ SYMBOL: changed?
     inline recursive
 
 : detect-loops ( call-graph -- )
-    H{ } clone not-loops set
+    HS{ } clone not-loops set
     V{ } clone recursive-nesting set
     [ visit-back-edges ]
     [ '[ _ detect-cross-frame-calls ] while-changing ]