]> gitweb.factorcode.org Git - factor.git/commitdiff
Cleanup more lint warnings.
authorJohn Benediktsson <mrjbq7@gmail.com>
Fri, 14 Oct 2011 19:31:06 +0000 (12:31 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Fri, 14 Oct 2011 19:31:46 +0000 (12:31 -0700)
17 files changed:
basis/alien/parser/parser.factor
basis/bitstreams/bitstreams.factor
basis/db/tuples/tuples.factor
basis/db/types/types.factor
basis/editors/editors.factor
basis/farkup/farkup.factor
basis/functors/functors.factor
basis/logging/logging.factor
basis/peg/peg.factor
basis/syndication/syndication.factor
basis/validators/validators.factor
core/lexer/lexer.factor
extra/infix/infix.factor
extra/lint/lint.factor
extra/pair-methods/pair-methods.factor
extra/poker/poker.factor
extra/semantic-versioning/semantic-versioning.factor

index 39599d6d83b136ebf9bbfb16f35b9af43e15f455..a196e416de394f4dae2fa3c81b6646ebfef7b37e 100755 (executable)
@@ -9,9 +9,6 @@ IN: alien.parser
 
 SYMBOL: current-library
 
-: parse-c-type-name ( name -- word )
-    dup search [ ] [ no-word ] ?if ;
-
 DEFER: (parse-c-type)
 
 ERROR: bad-array-type ;
@@ -26,8 +23,8 @@ ERROR: bad-array-type ;
     {
         { [ "*" ?tail ] [ (parse-c-type) <pointer> ] }
         { [ CHAR: ] over member? ] [ parse-array-type ] }
-        { [ dup search ] [ parse-c-type-name ] }
-        [ dup search [ ] [ no-word ] ?if ]
+        { [ dup search ] [ parse-word ] }
+        [ parse-word ]
     } cond ;
 
 : c-array? ( c-type -- ? )
index 5581e47056634e2c5fa0b13b783b13d1eebf4c03..12f75dc6ee1ff113cc022797eb4668124523e48c 100644 (file)
@@ -49,7 +49,7 @@ TUPLE: lsb0-bit-writer < bit-writer ;
 : new-bit-writer ( class -- bs )
     new
         BV{ } clone >>bytes
-        0 0 <widthed> >>widthed ; inline
+        zero-widthed >>widthed ; inline
 
 : <msb0-bit-writer> ( -- bs )
     msb0-bit-writer new-bit-writer ;
index 2d2fe2314f55ef246c4e47c61336ae5da3e62d32..45fbf31a0fb66aa52c6f0d3d0bd7b404170e87a7 100644 (file)
@@ -131,8 +131,7 @@ ERROR: no-defined-persistent object ;
 : ensure-tables ( classes -- ) [ ensure-table ] each ;
 
 : insert-tuple ( tuple -- )
-    dup class ensure-defined-persistent
-    db-columns find-primary-key db-assigned-id-spec?
+    dup class ensure-defined-persistent db-assigned?
     [ insert-db-assigned-statement ] [ insert-user-assigned-statement ] if ;
 
 : update-tuple ( tuple -- )
index 30116e3fc53365ef6cb270a56f271697537edb9f..1ad81ad3ee9e3a0936a8f83a7c585d210836a6d5 100644 (file)
@@ -38,8 +38,7 @@ SYMBOL: IGNORE
 ERROR: no-slot ;
 
 : offset-of-slot ( string tuple -- n )
-    class superclasses [ "slots" word-prop ] map concat
-    slot-named dup [ no-slot ] unless offset>> ;
+    class all-slots slot-named dup [ no-slot ] unless offset>> ;
 
 : get-slot-named ( name tuple -- value )
     [ nip ] [ offset-of-slot ] 2bi slot ;
index 7e16c1c218478d08fdef4734d1165d5b7a2768a4..8c97cddfb057fa8037f8dcaecb586b3eed9bd8ab 100644 (file)
@@ -16,7 +16,7 @@ M: no-edit-hook summary
 SYMBOL: edit-hook
 
 : available-editors ( -- seq )
-    "editors" child-vocabs no-roots no-prefixes [ vocab-name ] map ;
+    "editors" child-vocab-names ;
 
 : editor-restarts ( -- alist )
     available-editors
index 439c50b14439fa3505df1e8f760d4a8280d11d53..d54587caf2f7f8795add4e5d3703c0e3427c9f94 100644 (file)
@@ -102,9 +102,7 @@ DEFER: (parse-paragraph)
         ] [ drop "" like 1list ] if*
     ] if-empty ;
 
-: <farkup-state> ( string -- state ) string-lines ;
 : look ( state i -- char ) swap first ?nth ;
-: take-line ( state -- state' line ) unclip-slice ;
 
 : take-lines ( state char -- state' lines )
     dupd '[ ?first _ = not ] find drop
@@ -136,7 +134,7 @@ DEFER: (parse-paragraph)
     [ trim= parse-paragraph ] dip boa ; inline
 
 : parse-heading ( state -- state' heading )
-    take-line dup count= {
+    unclip-slice dup count= {
         { 0 [ make-paragraph ] }
         { 1 [ heading1 make-heading ] }
         { 2 [ heading2 make-heading ] }
@@ -168,7 +166,7 @@ DEFER: (parse-paragraph)
     ] map table boa ;
 
 : parse-line ( state -- state' item )
-    take-line dup "___" =
+    unclip-slice dup "___" =
     [ drop line new ] [ make-paragraph ] if ;
 
 : parse-list ( state char class -- state' list )
@@ -185,12 +183,12 @@ DEFER: (parse-paragraph)
 
 : parse-code ( state -- state' item )
     dup 1 look CHAR: [ =
-    [ take-line make-paragraph ] [
+    [ unclip-slice make-paragraph ] [
         dup "{" take-until [
             [ nip rest ] dip
             "}]" take-until
             [ code boa ] dip swap
-        ] [ drop take-line make-paragraph ] if*
+        ] [ drop unclip-slice make-paragraph ] if*
     ] if ;
 
 : parse-item ( state -- state' item )
@@ -202,11 +200,11 @@ DEFER: (parse-paragraph)
         { CHAR: # [ parse-ol ] } 
         { CHAR: [ [ parse-code ] }
         { f [ rest-slice f ] }
-        [ drop take-line make-paragraph ]
+        [ drop unclip-slice make-paragraph ]
     } case ;
 
 : parse-farkup ( string -- farkup )
-    <farkup-state> [ dup empty? not ] [ parse-item ] produce nip sift ;
+    string-lines [ dup empty? not ] [ parse-item ] produce nip sift ;
 
 CONSTANT: invalid-url "javascript:alert('Invalid URL in farkup');"
 
index 8e1364b495033e68a2df4518f704444ef474d045..b3ebaa4749f2c645b22e76f2d5eb046196693ac4 100644 (file)
@@ -127,7 +127,7 @@ FUNCTOR-SYNTAX: call-next-method T{ fake-call-next-method } suffix! ;
 
 PRIVATE>
 
-SYNTAX: IS [ dup search [ ] [ no-word ] ?if ] (INTERPOLATE) ;
+SYNTAX: IS [ parse-word ] (INTERPOLATE) ;
 
 SYNTAX: DEFERS [ current-vocab create ] (INTERPOLATE) ;
 
index 0521951574ccc0833ef5b52522edd84f3c6066c5..ddcde5a1ac2b72e1a8569f12e5b3ed40f572248b 100644 (file)
@@ -26,7 +26,7 @@ log-level [ DEBUG ] initialize
 ERROR: undefined-log-level ;\r
 \r
 : log-level<=> ( log-level log-level -- ? )\r
-    [ log-levels at* [ undefined-log-level ] unless ] bi@ <=> ;\r
+    [ log-levels at* [ undefined-log-level ] unless ] compare ;\r
 \r
 : log? ( log-level -- ? )\r
     log-level get log-level<=> +lt+ = not ;\r
index e0c5350ed1e470bff7e8f2e38c5b98694bf239f8..4511c9d235ec8442c3caa8ac3f2c445847d9c0d7 100644 (file)
@@ -22,9 +22,9 @@ SYMBOL: error-stack
 
 : (merge-errors) ( a b -- c )
   {
-    { [ over position>> not ] [ nip ] } 
-    { [ dup  position>> not ] [ drop ] } 
-    [ 2dup [ position>> ] bi@ <=> {
+    { [ over position>> not ] [ nip ] }
+    { [ dup  position>> not ] [ drop ] }
+    [ 2dup [ position>> ] compare {
         { +lt+ [ nip ] }
         { +gt+ [ drop ] }
         { +eq+ [ messages>> over messages>> union [ position>> ] dip <parse-error> ] }
index fe31a49265d425ca2f4d9e7592b0292a329a44c4..88fae781ea2303e521e9fe6f0f8d84313bf9056e 100644 (file)
@@ -28,8 +28,7 @@ TUPLE: entry title url description date ;
     [ rfc822>timestamp ] [ drop rfc3339>timestamp ] recover ;
 
 : rss1.0-entry ( tag -- entry )
-    entry new
-    swap {
+    <entry> swap {
         [ "title" tag-named children>string >>title ]
         [ "link" tag-named children>string >url >>url ]
         [ "description" tag-named children>string >>description ]
@@ -41,16 +40,14 @@ TUPLE: entry title url description date ;
     } cleave ;
 
 : rss1.0 ( xml -- feed )
-    feed new
-    swap [
+    <feed> swap [
         "channel" tag-named
         [ "title" tag-named children>string >>title ]
         [ "link" tag-named children>string >url >>url ] bi
     ] [ "item" tags-named [ rss1.0-entry ] map set-entries ] bi ;
 
 : rss2.0-entry ( tag -- entry )
-    entry new
-    swap {
+    <entry> swap {
         [ "title" tag-named children>string >>title ]
         [ { "link" "guid" } any-tag-named children>string >url >>url ]
         [ { "description" "encoded" } any-tag-named children>string >>description ]
@@ -61,9 +58,8 @@ TUPLE: entry title url description date ;
     } cleave ;
 
 : rss2.0 ( xml -- feed )
-    feed new
-    swap
-    "channel" tag-named 
+    <feed> swap
+    "channel" tag-named
     [ "title" tag-named children>string >>title ]
     [ "link" tag-named children>string >url >>url ]
     [ "item" tags-named [ rss2.0-entry ] map set-entries ]
@@ -75,8 +71,7 @@ TUPLE: entry title url description date ;
     dup [ "href" attr >url ] when ;
 
 : atom1.0-entry ( tag -- entry )
-    entry new
-    swap {
+    <entry> swap {
         [ "title" tag-named children>string >>title ]
         [ atom-entry-link >>url ]
         [
index 45287a60c6641ef7e45fffd4610e86dc4166cdd0..a440ccff9c51f0c96752a857b1ec9b4189b3b19f 100644 (file)
@@ -1,15 +1,16 @@
 ! Copyright (C) 2006, 2010 Slava Pestov
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel continuations sequences math namespaces make sets
-math.parser math.ranges assocs regexp unicode.categories arrays
-hashtables words classes quotations xmode.catalog unicode.case ;
+USING: arrays assocs classes continuations hashtables kernel
+make math math.functions math.parser math.ranges namespaces
+quotations regexp sequences sets unicode.case unicode.categories
+words xmode.catalog ;
 IN: validators
 
 : v-checkbox ( str -- ? )
     >lower "on" = ;
 
 : v-default ( str def -- str/def )
-    [ drop empty? not ] 2keep ? ;
+    [ drop empty? not ] most ;
 
 : v-required ( str -- str )
     dup empty? [ "required" throw ] when ;
@@ -94,7 +95,7 @@ IN: validators
 : luhn? ( str -- ? )
     string>digits <reversed>
     [ odd? [ 2 * 10 /mod + ] when ] map-index
-    sum 10 mod 0 = ;
+    sum 10 divisor? ;
 
 : v-credit-card ( str -- n )
     "- " without
index 8caaf78403426a11d031f9efd89cf9dbd75e423a..ad755003cb3fe05c516b4f22bdc1c3f93ad4b517 100644 (file)
@@ -26,7 +26,7 @@ TUPLE: lexer-parsing-word word line line-text column ;
     ] [ parsing-words>> push ] bi ;
 
 : pop-parsing-word ( -- )
-    lexer get parsing-words>> pop drop ;
+    lexer get parsing-words>> pop* ;
 
 : new-lexer ( text class -- lexer )
     new
index 2cfdbf10808b4874956e4eb1ae84489db6c58359..3778031c4df73ee35bcb24ce214e14b12fad02d8 100644 (file)
@@ -77,8 +77,7 @@ M: bad-stack-effect summary
     [ = ] dip 1 = and ;
 
 : find-and-check ( args argcount string -- quot )
-    dup search [ ] [ no-word ] ?if
-    [ nip ] [ check-word ] 2bi
+    parse-word [ nip ] [ check-word ] 2bi
     [ 1quotation compose ] [ bad-stack-effect ] if ;
 
 : arguments-codegen ( seq -- quot )
index ce1708f9bf426b57b1f13684899f95a93fb9ef86..85d2e9b639ef48ee4bbb5a89d4211a3f263f0112 100644 (file)
@@ -36,6 +36,7 @@ CONSTANT: trivial-defs
         [ . ]
         [ new ]
         [ get ]
+        [ "" ]
         [ t ] [ f ]
         [ { } ]
         [ drop t ] [ drop f ] [ 2drop t ] [ 2drop f ]
index 28a1182cf259eaf4172ea512fd59cebacb3b284a..3971c3e1a2ae0442998859612547299134cdc9a0 100644 (file)
@@ -26,7 +26,7 @@ ERROR: no-pair-method a b generic ;
 : pair-generic-definition ( word -- def )
     [ sorted-pair-methods [ first2 pair-method-cond ] map ]
     [ [ no-pair-method ] curry suffix ] bi 1quotation
-    [ 2dup [ class ] bi@ <=> +gt+ eq? ?swap ] [ cond ] surround ;
+    [ 2dup [ class ] compare +gt+ eq? ?swap ] [ cond ] surround ;
 
 : make-pair-generic ( word -- )
     dup pair-generic-definition define ;
index 9b61a958235506dcca2ceafb3abbdf91679a6831..8cbb92a2ddac94f2e572030aaa8459dbc0e59524 100644 (file)
@@ -215,7 +215,7 @@ ERROR: no-card card deck ;
         sampled 2 cut :> ( hole2 community2 )
         hole1 community community2 3append :> hand1
         hole2 community community2 3append :> hand2
-        hand1 hand2 [ best-holdem-hand 2array ] bi@ <=> +lt+ =
+        hand1 hand2 [ best-holdem-hand 2array ] compare +lt+ =
     ] count ;
 
 :: compare-holdem-hands ( holes deck n -- seq )
index 86973688cb8865b47068a536f7b8b0892622cf98..f7bf382d5da11a6849aa7d60be5806caaf13d43c 100644 (file)
@@ -13,7 +13,7 @@ IN: semantic-versioning
 : version<=> ( version1 version2 -- <=> )
     [ split-version ] bi@ drop-prefix
     2dup [ length 0 = ] either?
-    [ [ length ] bi@ >=< ] [ [ first ] bi@ <=> ] if ;
+    [ [ length ] bi@ >=< ] [ [ first ] compare ] if ;
 
 : version< ( version1 version2 -- ? )
     version<=> +lt+ = ;