]> gitweb.factorcode.org Git - factor.git/commitdiff
words: add safety checks for word? type.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 11 Mar 2013 18:41:22 +0000 (11:41 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 12 Mar 2013 04:21:44 +0000 (21:21 -0700)
core/words/words.factor

index 8b3f60e8f151d8a3ee8fb375d26aa495e94bfa19..56ef998d7d2ea6545aca18b25590a240082b52b2 100644 (file)
@@ -110,11 +110,17 @@ M: word parent-word drop f ;
 : make-deprecated ( word -- )
     t "deprecated" set-word-prop ;
 
-: inline? ( word -- ? ) "inline" word-prop ; inline
+: inline? ( obj -- ? )
+    dup word? [ "inline" word-prop ] [ drop f ] if ; inline
 
-: inline-recursive? ( word -- ? )
-    dup "inline" word-prop
-    [ "recursive" word-prop ] [ drop f ] if ; inline
+: recursive? ( obj -- ? )
+    dup word? [ "recursive" word-prop ] [ drop f ] if ; inline
+
+: inline-recursive? ( obj -- ? )
+    dup word? [
+        dup "inline" word-prop
+        [ "recursive" word-prop ] [ drop f ] if
+    ] [ drop f ] if ; inline
 
 ERROR: cannot-be-inline word ;