Skip to content

Commit

Permalink
Fix restart calculation for compiled closures (Alan Ruttenberg)
Browse files Browse the repository at this point in the history
Fix getFunctionClassBytes for CompiledClosures.

Closes <#3> and <http://abcl.org/trac/ticket/414>.
  • Loading branch information
mevenson@1c010e3e-69d0-11dd-93a8-456734b0d56f committed Jan 16, 2017
1 parent 1028ea2 commit f9a6e43
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions src/org/armedbear/lisp/restart.lisp
Expand Up @@ -62,21 +62,26 @@
,@forms))

(defun compute-restarts (&optional condition)
(let ((res ()))
(map-restarts (lambda(restart) (push restart res)) condition t)
(nreverse res)))

(defun map-restarts (fn condition call-test-p)
(let ((associated ())
(other ()))
(dolist (alist *condition-restarts*)
(if (eq (car alist) condition)
(setq associated (cdr alist))
(setq other (append (cdr alist) other))))
(let ((res ()))
(dolist (restart-cluster *restart-clusters*)
(dolist (restart restart-cluster)
(when (and (or (not condition)
(member restart associated)
(not (member restart other)))
(funcall (restart-test-function restart) condition))
(push restart res))))
(nreverse res))))
(dolist (restart-cluster *restart-clusters*)
(dolist (restart restart-cluster)
(when (and (or (not condition)
(member restart associated)
(not (member restart other)))
(or (not call-test-p)
(funcall (restart-test-function restart) condition)))
(funcall fn restart))))))


(defun restart-report (restart stream)
(funcall (or (restart-report-function restart)
Expand Down Expand Up @@ -105,7 +110,16 @@
:format-arguments (list identifier))))

(defun invoke-restart (restart &rest values)
(let ((real-restart (find-restart-or-control-error restart)))
(let ((real-restart
(if (restart-p restart)
(catch 'found
(map-restarts (lambda(r) (when (eq r restart)
(throw 'found r)))
nil nil)
(error 'control-error
:format-control "Restart ~S is not active."
:format-arguments (list restart)))
(find-restart-or-control-error restart))))
(apply (restart-function real-restart) values)))

(defun interactive-restart-arguments (real-restart)
Expand All @@ -115,11 +129,20 @@
'())))

(defun invoke-restart-interactively (restart)
(let* ((real-restart (find-restart-or-control-error restart))
(args (interactive-restart-arguments real-restart)))
(let* ((real-restart
(if (restart-p restart)
(catch 'found
(map-restarts (lambda(r) (when (eq r restart)
(throw 'found r)))
nil nil)
(error 'control-error
:format-control "Restart ~S is not active."
:format-arguments (list restart)))
(find-restart-or-control-error restart)))
(args (interactive-restart-arguments real-restart))
)
(apply (restart-function real-restart) args)))


(defun parse-keyword-pairs (list keys)
(do ((l list (cddr l))
(k '() (list* (cadr l) (car l) k)))
Expand Down

0 comments on commit f9a6e43

Please sign in to comment.