cl: unwind-protect — cleanup frame in cl-eval-ast, 8 new tests (159 eval)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -309,6 +309,16 @@
|
||||
(:else (run (+ i 1))))))))))
|
||||
(run 0))))
|
||||
|
||||
;; ── UNWIND-PROTECT ───────────────────────────────────────────────
|
||||
|
||||
(define cl-eval-unwind-protect
|
||||
(fn (args env)
|
||||
(let ((protected (nth args 0))
|
||||
(cleanup (rest args)))
|
||||
(let ((result (cl-eval protected env)))
|
||||
(for-each (fn (f) (cl-eval f env)) cleanup)
|
||||
result))))
|
||||
|
||||
;; ── BLOCK / RETURN-FROM ───────────────────────────────────────────
|
||||
|
||||
(define cl-eval-block
|
||||
@@ -605,6 +615,7 @@
|
||||
((= head "TAGBODY") (cl-eval-tagbody args env))
|
||||
((= head "GO")
|
||||
{:cl-type "go-tag" :tag (nth args 0)})
|
||||
((= head "UNWIND-PROTECT") (cl-eval-unwind-protect args env))
|
||||
((= head "BLOCK") (cl-eval-block args env))
|
||||
((= head "RETURN-FROM") (cl-eval-return-from args env))
|
||||
((= head "RETURN")
|
||||
|
||||
Reference in New Issue
Block a user