From 887003002331b2c27685319e902f748ce925f479 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Fri, 19 Mar 2021 14:03:51 -0700 Subject: factor out WITH-SKIP-FAILED-CHANGES Signed-off-by: Sean Whitton --- src/propspec.lisp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/propspec.lisp') diff --git a/src/propspec.lisp b/src/propspec.lisp index 0c395dd..c0cec5c 100644 --- a/src/propspec.lisp +++ b/src/propspec.lisp @@ -277,6 +277,13 @@ expression." (return-from ,name (list* psym args))))) ,@forms)))) +(defmacro with-skip-failed-changes (&body forms) + `(handler-bind ((failed-change + (lambda (c) + (declare (ignore c)) + (invoke-restart 'skip-property)))) + ,@forms)) + (define-function-property-combinator eseqprops (&rest propapps) (:retprop :type (collapse-types (mapcar #'propapptype propapps)) :check (constantly nil) @@ -288,11 +295,7 @@ expression." :check (constantly nil) :hostattrs (lambda () (mapc #'propappattrs propapps)) :apply (lambda () - (handler-bind - ((failed-change - (lambda (c) - (declare (ignore c)) - (invoke-restart 'skip-property)))) + (with-skip-failed-changes (apply-and-print propapps))))) (defmacro with-requirements (propapp &body requirements) @@ -306,11 +309,7 @@ apply the elements of REQUIREMENTS in reverse order." :check (constantly nil) :hostattrs (lambda () (mapc #'propappattrs propapps)) :apply (lambda () - (handler-bind - ((failed-change - (lambda (c) - (declare (ignore c)) - (invoke-restart 'skip-property)))) + (with-skip-failed-changes (mapc #'propappapply propapps))))) ;; note that the :FAILED-CHANGE value is only used within this function and -- cgit v1.2.3