1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-20 02:30:23 +02:00

peval: add support for <prompt> and <abort>

* module/language/tree-il/optimize.scm (alpha-rename, peval): Handle
  <prompt> and <abort>.  Attempt to remove the prompt if the tag is
  otherwise unreferenced.

* module/language/tree-il/primitives.scm (*primitive-constructors*): Add
  make-prompt-tag as a constructor.

* test-suite/tests/tree-il.test ("partial evaluation"): Add a test that
  an prompt whose tag is unreferenced is removed.
This commit is contained in:
Andy Wingo 2011-09-27 13:39:29 +02:00
parent fbc9387f68
commit ea726a53b2
3 changed files with 77 additions and 3 deletions

View file

@ -1275,6 +1275,17 @@
(cdr (list (bar) 0))
(begin (apply (toplevel bar)) (apply (primitive list) (const 0))))
(pass-if-peval
resolve-primitives
;; Prompt is removed if tag is unreferenced
(let ((tag (make-prompt-tag)))
(call-with-prompt tag
(lambda () 1)
(lambda args args)))
;; FIXME: elide the (make-prompt-tag) call
(begin
(apply (primitive make-prompt-tag))
(const 1)))
)