]> 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 1bf75e7ec9dca83f6a36cac34f33b1577a244859..09cdc08b256b8ada7355705a70226a3f83b9dca8 100644 (file)
@@ -8,11 +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.
     infer effect>string print ;
+
+M: callable stack-effect infer ;