]> gitweb.factorcode.org Git - factor.git/commitdiff
Cleanup lint warnings.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 14 Oct 2011 17:23:52 +0000 (10:23 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 14 Oct 2011 18:47:24 +0000 (11:47 -0700)
19 files changed:
basis/alien/parser/parser.factor
basis/classes/struct/bit-accessors/bit-accessors.factor
basis/compiler/cfg/liveness/liveness.factor
basis/compiler/cfg/representations/selection/selection.factor
basis/compiler/cfg/stacks/uninitialized/uninitialized.factor
basis/compiler/tree/modular-arithmetic/modular-arithmetic.factor
basis/compiler/tree/propagation/inlining/inlining.factor
basis/compiler/tree/tuple-unboxing/tuple-unboxing.factor
basis/farkup/farkup.factor
basis/furnace/asides/asides.factor
basis/furnace/conversations/conversations.factor
basis/furnace/recaptcha/recaptcha.factor
basis/http/parsers/parsers.factor
basis/ui/tools/browser/popups/popups.factor
core/classes/tuple/parser/parser.factor
core/growable/growable.factor
core/sequences/sequences.factor
core/sets/sets.factor
extra/lint/lint.factor

index d4824507d2f376144c8f50490ee72450e7297421..39599d6d83b136ebf9bbfb16f35b9af43e15f455 100755 (executable)
@@ -88,7 +88,7 @@ M: pointer return-type-name to>> return-type-name CHAR: * suffix ;
     [ [ 2array suffix! ] [ enum>number 1 + ] bi ] 2bi ;
 
 : parse-enum-name ( -- name )
-    scan-token (CREATE-C-TYPE) dup save-location ;
+    CREATE-C-TYPE dup save-location ;
 
 : parse-enum-base-type ( -- base-type token )
     scan-token dup "<" =
index c5959ab7acde83e447cbb749a0d9613ddcea2f05..a8015387968f5cd0ffbeccac774307c3f3699d07 100644 (file)
@@ -1,13 +1,14 @@
 ! Copyright (C) 2009 Daniel Ehrenberg
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel sequences math fry locals math.order alien.accessors ;
+USING: alien.accessors fry kernel locals math math.bitwise
+math.order sequences ;
 IN: classes.struct.bit-accessors
 
 ! Bitfield accessors are little-endian on all platforms
 ! Why not? It's unspecified in C
 
 : ones-between ( start end -- n )
-    [ 2^ 1 - ] bi@ swap bitnot bitand ;
+    [ on-bits ] bi@ swap unmask ;
 
 :: manipulate-bits ( offset bits step-quot -- quot shift-amount offset' bits' )
     offset 8 /mod :> ( i start-bit )
index 772e4f390fb07e3ce9c389bb5306f953185ed7b6..2c6bcdfa476658e920a851c3a03ffa928531ee69 100644 (file)
@@ -122,7 +122,7 @@ M: insn visit-insn drop ;
 SYMBOL: work-list
 
 : add-to-work-list ( basic-blocks -- )
-    work-list get '[ _ push-front ] each ;
+    work-list get push-all-front ;
 
 : compute-live-in ( basic-block -- live-in )
     [ live-out ] keep instructions>> transfer-liveness ;
index d0e156f31ea77b84570b62af563532b734c576a8..3d435edc0926ae5d00e3ce6fdc8197d7f3b71e1b 100644 (file)
@@ -57,7 +57,7 @@ SYMBOL: possibilities
 : possible-reps ( vreg reps -- vreg reps )
     { tagged-rep } union
     2dup [ tagged-vregs get in? not ] [ { tagged-rep } = ] bi* and
-    [ drop { tagged-rep int-rep } ] [ ] if ;
+    [ drop { tagged-rep int-rep } ] when ;
 
 : compute-possibilities ( cfg -- )
     collect-vreg-reps
index 7ceb867dbc556ef3b91a14ec2d3cb7a4ac2369bd..eadfe0aa9152b4823049322f57cf37e5a4aa19d4 100644 (file)
@@ -68,7 +68,7 @@ M: insn visit-insn drop ;
 : finish ( -- pair ) ds-loc get rs-loc get 2array ;
 
 : (join-sets) ( seq1 seq2 -- seq )
-    2dup [ length ] bi@ max '[ _ 1 pad-tail ] bi@ [ bitand ] 2map ;
+    2dup max-length '[ _ 1 pad-tail ] bi@ [ bitand ] 2map ;
 
 PRIVATE>
 
index a737b97023bb40d479c0c2f5b5a540e74674a12a..55669f06c179ca4f3f9a503eb1e96486aff01ac3 100644 (file)
@@ -109,7 +109,7 @@ M: node compute-modular-candidates*
 GENERIC: only-reads-low-order? ( node -- ? )
 
 : output-modular? ( #call -- ? )
-    out-d>> first modular-values get key? ;
+    out-d>> first modular-value? ;
 
 M: #call only-reads-low-order?
     {
index 5375ff68819b246ebc1ec373aaee31cfd019f940..6b4023241243783758cbcf4c0af5d150320bc20d 100644 (file)
@@ -105,7 +105,7 @@ SYMBOL: history
     "custom-inlining" word-prop ;
 
 : inline-custom ( #call word -- ? )
-    [ dup ] [ "custom-inlining" word-prop ] bi*
+    [ dup ] [ custom-inlining? ] bi*
     call( #call -- word/quot/f )
     object swap eliminate-dispatch ;
 
index d4ca3010cee4b428fb77c7c959d94df9789d5f1d..b13334e5d07486df15faa7634737383952765219 100644 (file)
@@ -169,5 +169,5 @@ M: #alien-node unbox-tuples* dup in-d>> assert-not-unboxed ;
 M: #alien-callback unbox-tuples* ;
 
 : unbox-tuples ( nodes -- nodes )
-    allocations get escaping-allocations get assoc-diff assoc-empty?
+    (allocation) escaping-allocations get assoc-diff assoc-empty?
     [ [ unbox-tuples* ] map-nodes ] unless ;
index 9473ccedfb66f757e729ebc257c58391f1aabdb5..439c50b14439fa3505df1e8f760d4a8280d11d53 100644 (file)
@@ -104,7 +104,6 @@ DEFER: (parse-paragraph)
 
 : <farkup-state> ( string -- state ) string-lines ;
 : look ( state i -- char ) swap first ?nth ;
-: done? ( state -- ? ) empty? ;
 : take-line ( state -- state' line ) unclip-slice ;
 
 : take-lines ( state char -- state' lines )
@@ -207,7 +206,7 @@ DEFER: (parse-paragraph)
     } case ;
 
 : parse-farkup ( string -- farkup )
-    <farkup-state> [ dup done? not ] [ parse-item ] produce nip sift ;
+    <farkup-state> [ dup empty? not ] [ parse-item ] produce nip sift ;
 
 CONSTANT: invalid-url "javascript:alert('Invalid URL in farkup');"
 
index 254cb04fed839b4c482fd9a1bf9f982206ccc216..4f2568b636ad67a4cd6fa1b75b4c2fefe5b46a8e 100644 (file)
@@ -46,8 +46,7 @@ SYMBOL: aside-id
 
 : init-asides ( asides -- )
     asides set
-    request get request-aside-id
-    get-aside
+    request get request-aside
     set-aside ;
 
 M: asides call-responder*
index 82a4de242989c10e24fad868055fc753ace7f155..be10a1d30b486be5fbf271d77de5f9402efaef6e 100644 (file)
@@ -62,8 +62,7 @@ SYMBOL: conversation-id
 
 : init-conversations ( conversations -- )
     conversations set
-    request get request-conversation-id
-    get-conversation
+    request get request-conversation
     set-conversation ;
 
 M: conversations call-responder*
index 4ac03ce839b9302e0d07282d39b4fda581527120..3ae20f14bbf9df2779bc4aa473bef4a1c05a5d2e 100644 (file)
@@ -59,7 +59,7 @@ M: recaptcha call-responder*
         { "privatekey" private-key }
         { "remoteip" remote-ip }
     } URL" http://api-verify.recaptcha.net/verify"
-    <post-request> http-request nip parse-recaptcha-response ;
+    http-post nip parse-recaptcha-response ;
 
 : validate-recaptcha-params ( -- )
     {
index 9c81510925bd5ca31508052222f27255edf04600..475074d378fe66c0ec5628b5d22491074e319b6f 100644 (file)
@@ -11,14 +11,11 @@ IN: http.parsers
 : except-these ( quots -- parser )
     [ 1|| ] curry except ; inline
 
-: ctl? ( ch -- ? )
-    { [ 0 31 between? ] [ 127 = ] } 1|| ;
-
 : tspecial? ( ch -- ? )
     "()<>@,;:\\\"/[]?={} \t" member? ;
 
 : 'token' ( -- parser )
-    { [ ctl? ] [ tspecial? ] } except-these repeat1 ;
+    { [ control? ] [ tspecial? ] } except-these repeat1 ;
 
 : case-insensitive ( parser -- parser' )
     [ flatten >string >lower ] action ;
@@ -62,7 +59,7 @@ PEG: parse-request-line ( string -- triple )
     ] seq* just ;
 
 : 'text' ( -- parser )
-    [ ctl? ] except ;
+    [ control? ] except ;
 
 : 'response-code' ( -- parser )
     [ digit? ] satisfy 3 exactly-n [ string>number ] action ;
@@ -88,7 +85,7 @@ PEG: parse-response-line ( string -- triple )
     [ " \t" member? ] satisfy repeat1 ;
 
 : 'qdtext' ( -- parser )
-    { [ CHAR: " = ] [ ctl? ] } except-these ;
+    { [ CHAR: " = ] [ control? ] } except-these ;
 
 : 'quoted-char' ( -- parser )
     "\\" token hide any-char 2seq ;
@@ -97,7 +94,7 @@ PEG: parse-response-line ( string -- triple )
     'quoted-char' 'qdtext' 2choice repeat0 "\"" "\"" surrounded-by ;
 
 : 'ctext' ( -- parser )
-    { [ ctl? ] [ "()" member? ] } except-these ;
+    { [ control? ] [ "()" member? ] } except-these ;
 
 : 'comment' ( -- parser )
     'ctext' 'comment' 2choice repeat0 "(" ")" surrounded-by ;
index ac4318fa92ee8b9a43b3821648640d5e4f742d3c..b5ceda461efa24824e853f22e61b2085ecc0c68b 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs definitions fry help.topics kernel
+USING: accessors arrays assocs definitions fry help kernel
 colors.constants math.rectangles models.arrow namespaces sequences
 sorting definitions.icons tools.crossref ui.gadgets ui.gadgets.glass
 ui.gadgets.labeled ui.gadgets.scrollers ui.gadgets.tables
@@ -18,14 +18,11 @@ M: link-renderer row-value drop first ;
 
 TUPLE: links-popup < wrapper ;
 
-: sorted-links ( links -- alist )
-    [ dup article-title ] { } map>assoc sort-values ;
-
 : match? ( value str -- ? )
     swap second subseq? ;
 
 : <links-table> ( model quot -- table )
-    '[ @ sorted-links ] <arrow>
+    '[ @ sort-articles ] <arrow>
     link-renderer [ second ] <search-table>
         [ invoke-primary-operation ] >>action
         [ hide-glass ] >>hook
index 1bc10677246595a4eff9ef511bf19f44a962115d..701a4b760488dd49de66954a2cf2a90a5e79cd8a 100644 (file)
@@ -69,7 +69,7 @@ ERROR: bad-literal-tuple ;
 ERROR: bad-slot-name class slot ;
 
 : check-slot-name ( class slots name -- name )
-    2dup swap slot-named* nip [ 2nip ] [ nip bad-slot-name ] if ;
+    2dup swap slot-named [ 2nip ] [ nip bad-slot-name ] if ;
 
 : parse-slot-value ( class slots -- )
     scan-token check-slot-name scan-object 2array , scan-token {
index 8d52c98c71008a545d1499ffc87de1f5a65adb9f..0144cdf58f540e0924504f63eaaa87fd67885591 100644 (file)
@@ -25,11 +25,8 @@ M: growable contract ( len seq -- )
     [ [ 0 ] 2dip set-nth-unsafe ] curry
     (each-integer) ; inline
 
-: growable-check ( n seq -- n seq )
-    over 0 < [ bounds-error ] when ; inline
-
 M: growable set-length ( n seq -- )
-    growable-check
+    bounds-check-head
     2dup length < [
         2dup contract
     ] [
@@ -40,7 +37,7 @@ M: growable set-length ( n seq -- )
 : new-size ( old -- new ) 1 + 3 * ; inline
 
 : ensure ( n seq -- n seq )
-    growable-check
+    bounds-check-head
     2dup length >= [
         2dup capacity >= [ over new-size over expand ] when
         [ >fixnum ] dip
@@ -60,7 +57,7 @@ M: growable lengthen ( n seq -- )
     ] when 2drop ; inline
 
 M: growable shorten ( n seq -- )
-    growable-check
+    bounds-check-head
     2dup length < [
         2dup contract
         2dup length<<
index 32cbce114f04dfbe4c3026f3934be7f7044fb382..0426a8bd9cdf5dfe29025b8617ed92ed5370a816 100644 (file)
@@ -288,8 +288,11 @@ C: <copy> copy-state
     [ over - check-length swap ] dip
     3dup nip new-sequence 0 swap <copy> ; inline
 
+: bounds-check-head ( n seq -- n seq )
+    over 0 < [ bounds-error ] when ; inline
+
 : check-copy ( src n dst -- src n dst )
-    3dup over 0 < [ bounds-error ] when
+    3dup bounds-check-head
     [ swap length + ] dip lengthen ; inline
 
 PRIVATE>
@@ -411,7 +414,7 @@ PRIVATE>
     pick [ [ (each-index) ] dip call ] dip finish-find ; inline
 
 : (accumulate) ( seq identity quot -- identity seq quot )
-    [ swap ] dip [ curry keep ] curry ; inline
+    swapd [ curry keep ] curry ; inline
 
 PRIVATE>
 
index 3b5192b008e00f7f7b493d164d2b283d785e90ef..1c4a3446125e1707f4302fda045aae4a40fa9f66 100644 (file)
@@ -128,10 +128,10 @@ M: sequence cardinality
     [ [ f fast-set ] unless* [ adjoin ] keep ] change-at ;
 
 : within ( seq set -- subseq )
-    fast-set [ in? ] curry filter ;
+    tester filter ;
 
 : without ( seq set -- subseq )
-    fast-set [ in? not ] curry filter ;
+    tester [ not ] compose filter ;
 
 ! Temporarily for compatibility
 
index 71c69796e61d13b80b4a55bd428d1349c1f7b569..ce1708f9bf426b57b1f13684899f95a93fb9ef86 100644 (file)
@@ -31,13 +31,14 @@ SYMBOL: lint-definitions-keys
 
 CONSTANT: trivial-defs
     {
-        [ drop ] [ 2array ]
+        [ drop ] [ 2drop ] [ 2array ]
         [ bitand ]
         [ . ]
+        [ new ]
         [ get ]
         [ t ] [ f ]
         [ { } ]
-        [ drop f ] [ 2drop ] [ 2drop t ]
+        [ drop t ] [ drop f ] [ 2drop t ] [ 2drop f ]
         [ cdecl ]
         [ first ] [ second ] [ third ] [ fourth ]
         [ ">" write ] [ "/>" write ]
@@ -165,4 +166,7 @@ M: word run-lint ( word -- seq ) 1array run-lint ;
 
 : lint-vocab ( vocab -- seq ) words run-lint dup lint. ;
 
+: lint-vocabs ( prefix -- seq )
+    [ vocabs ] dip [ head? ] curry filter [ lint-vocab ] map ;
+
 : lint-word ( word -- seq ) 1array run-lint dup lint. ;