From: Nikodemus Siivola Date: Thu, 18 Oct 2007 13:23:12 +0000 (+0000) Subject: 1.0.10.48: new function TRY-RESTART X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=1964eac5c1628e5174bc4eac2d83b0d78f46c997;p=sbcl.git 1.0.10.48: new function TRY-RESTART * Factor out all "find-restart and maybe invoke-restart" logic to one place. --- diff --git a/src/code/condition.lisp b/src/code/condition.lisp index 44270bb..5b406e0 100644 --- a/src/code/condition.lisp +++ b/src/code/condition.lisp @@ -1287,15 +1287,16 @@ the values returned by the form as a list. No associated restarts.")) CONTROL-ERROR if none exists." (invoke-restart (find-restart-or-control-error 'muffle-warning condition))) +(defun try-restart (name condition &rest arguments) + (let ((restart (find-restart name condition))) + (when restart + (apply #'invoke-restart restart arguments)))) + (macrolet ((define-nil-returning-restart (name args doc) #!-sb-doc (declare (ignore doc)) `(defun ,name (,@args &optional condition) #!+sb-doc ,doc - ;; FIXME: Perhaps this shared logic should be pulled out into - ;; FLET MAYBE-INVOKE-RESTART? See whether it shrinks code.. - (let ((restart (find-restart ',name condition))) - (when restart - (invoke-restart restart ,@args)))))) + (try-restart ',name condition ,@args)))) (define-nil-returning-restart continue () "Transfer control to a restart named CONTINUE, or return NIL if none exists.") (define-nil-returning-restart store-value (value) diff --git a/version.lisp-expr b/version.lisp-expr index 06be281..aaf8ffa 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.10.47" +"1.0.10.48"