]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/lint/lint.factor
lint: fix using
[factor.git] / extra / lint / lint.factor
index dee21564c2c077a8ea79a73b458b8af7ca8c042e..b874bc8abbc483480c73f6c7c45adee5cb814bc5 100644 (file)
@@ -1,10 +1,11 @@
 ! Copyright (C) 2007, 2008, 2011 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs classes classes.tuple.private
-combinators.short-circuit continuations fry io kernel
-kernel.private locals.backend make math math.private namespaces
-prettyprint quotations sequences sequences.deep slots.private
-splitting stack-checker vocabs words words.alias ;
+USING: accessors arrays assocs assocs.extras classes
+classes.tuple.private combinators.short-circuit continuations io
+kernel kernel.private locals.backend make math math.private
+namespaces prettyprint quotations sequences sequences.deep
+shuffle slots.private splitting stack-checker vocabs words
+words.alias ;
 IN: lint
 
 <PRIVATE
@@ -17,7 +18,10 @@ CONSTANT: manual-substitutions
         { rot [ swapd swap ] }
         { over [ dup swap ] }
         { swapd [ [ swap ] dip ] }
+        { 2swap [ -roll -roll ] }
         { 2nip [ nip nip ] }
+        { 3nip [ 2nip nip ] }
+        { 4nip [ 3nip nip ] }
         { 2drop [ drop drop ] }
         { 3drop [ drop drop drop ] }
         { pop* [ pop drop ] }
@@ -29,7 +33,7 @@ CONSTANT: trivial-defs
     {
         [ ">" write ] [ "/>" write ] [ " " write ]
         [ 0 or + ]
-        [ dup length iota ]
+        [ dup length <iota> ]
         [ 0 swap copy ]
         [ dup length ]
         [ 0 swap ]
@@ -144,7 +148,7 @@ CONSTANT: trivial-defs
         [
             {
                 [ length 4 <= ]
-                [ first { drop 2drop 3drop nip 2nip } member? ]
+                [ first { drop 2drop 3drop nip 2nip 3nip 4nip } member? ]
                 [ rest-slice [ boolean? ] all? ]
             } 1&&
         ]
@@ -216,7 +220,7 @@ CONSTANT: trivial-defs
     [ { [ callable? ] [ ignore-def? not ] } 1&& ] deep-filter ;
 
 : (load-definitions) ( word def hash -- )
-    [ all-callables ] dip '[ _ push-at ] with each ;
+    [ all-callables ] dip push-at-each ;
 
 : load-definitions ( words -- hash )
     H{ } clone [ '[ dup def>> _ (load-definitions) ] each ] keep ;
@@ -246,7 +250,7 @@ GENERIC: lint ( obj -- seq )
 M: object lint ( obj -- seq ) drop f ;
 
 M: callable lint ( quot -- seq )
-    [ lint-definitions-keys get-global ] dip '[ _ subseq? ] filter ;
+    lint-definitions-keys get-global [ subseq-index? ] with filter ;
 
 M: word lint ( word -- seq/f )
     def>> [ callable? ] deep-filter [ lint ] map concat ;
@@ -280,7 +284,7 @@ GENERIC: run-lint ( obj -- obj )
     ] assoc-filter ;
 
 M: sequence run-lint ( seq -- seq )
-    [ dup lint ] { } map>assoc trim-self
+    [ lint ] zip-with trim-self
     [ second empty? ] reject filter-symbols ;
 
 M: word run-lint ( word -- seq ) 1array run-lint ;