]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/stack-checker/stack-checker.factor
Infer non-callables as though they're self-evaluating
[factor.git] / basis / stack-checker / stack-checker.factor
index beb5026a2ba8af94032d0caac64843892e58e860..09cdc08b256b8ada7355705a70226a3f83b9dca8 100644 (file)
@@ -8,15 +8,13 @@ stack-checker.errors stack-checker.inlining
 stack-checker.visitor.dummy ;
 IN: stack-checker
 
-GENERIC: infer ( quot -- effect )
-
-M: callable infer ( quot -- effect )
-    (infer) ;
+: infer ( quot -- effect )
+    dup callable?
+    [ [ infer-quot-here ] with-infer drop ]
+    [ drop ( -- x ) ] if ;
 
 : infer. ( quot -- )
-    #! Safe to call from inference transforms.
+    ! Safe to call from inference transforms.
     infer effect>string print ;
 
-: inputs ( quot -- n ) infer in>> length ;
-
-: outputs ( quot -- n ) infer out>> length ;
+M: callable stack-effect infer ;