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:
parent
fbc9387f68
commit
ea726a53b2
3 changed files with 77 additions and 3 deletions
|
@ -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)))
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue