1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

Peval: Fold `thunk?' in more cases.

* module/language/tree-il/peval.scm (peval): Better folding of the
  `thunk?' predicate.
This commit is contained in:
Andy Wingo 2013-10-23 10:35:30 +02:00
parent 40553c2016
commit 0f676d8725

View file

@ -1251,13 +1251,19 @@ top-level bindings from ENV and return the resulting expression."
(make-primcall src name args))))))
(($ <primcall> src 'thunk? (proc))
(match (for-value proc)
(($ <lambda> _ _ ($ <lambda-case> _ req))
(for-tail (make-const src (null? req))))
(proc
(case ctx
((effect) (make-void src))
(else (make-primcall src 'thunk? (list proc)))))))
(case ctx
((effect)
(for-tail (make-seq src proc (make-void src))))
(else
(match (for-value proc)
(($ <lambda> _ _ ($ <lambda-case> _ req))
(for-tail (make-const src (null? req))))
(proc
(match (find-definition proc 2)
(($ <lambda> _ _ ($ <lambda-case> _ req))
(for-tail (make-const src (null? req))))
(_
(make-primcall src 'thunk? (list proc)))))))))
(($ <primcall> src (? accessor-primitive? name) args)
(match (cons name (map for-value args))