X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Ffdefinition.lisp;fp=src%2Fcode%2Ffdefinition.lisp;h=f004d2d5bd32e789acb4c971f0af18f5f2e7f7f8;hb=a6c4b66e040824da2fc76e101f92940e8412c6d3;hp=a23c0e4886c31617482cc14f363e528f103733a1;hpb=a189a69454ef7635149319ae213b337f17c50d20;p=sbcl.git diff --git a/src/code/fdefinition.lisp b/src/code/fdefinition.lisp index a23c0e4..f004d2d 100644 --- a/src/code/fdefinition.lisp +++ b/src/code/fdefinition.lisp @@ -106,6 +106,9 @@ (let ((fdefn (fdefinition-object name nil))) (unless (and fdefn (fdefn-fun fdefn)) (error 'undefined-function :name name)) + (when (typep (fdefn-fun fdefn) 'generic-function) + (return-from encapsulate + (encapsulate-generic-function (fdefn-fun fdefn) type body))) ;; We must bind and close over INFO. Consider the case where we ;; encapsulate (the second) an encapsulated (the first) ;; definition, and later someone unencapsulates the encapsulated @@ -153,6 +156,9 @@ (let* ((fdefn (fdefinition-object name nil)) (encap-info (encapsulation-info (fdefn-fun fdefn)))) (declare (type (or encapsulation-info null) encap-info)) + (when (and fdefn (typep (fdefn-fun fdefn) 'generic-function)) + (return-from unencapsulate + (unencapsulate-generic-function (fdefn-fun fdefn) type))) (cond ((not encap-info) ;; It disappeared on us, so don't worry about it. ) @@ -179,6 +185,9 @@ ;;; Does NAME have an encapsulation of the given TYPE? (defun encapsulated-p (name type) (let ((fdefn (fdefinition-object name nil))) + (when (and fdefn (typep (fdefn-fun fdefn) 'generic-function)) + (return-from encapsulated-p + (encapsulated-generic-function-p (fdefn-fun fdefn) type))) (do ((encap-info (encapsulation-info (fdefn-fun fdefn)) (encapsulation-info (encapsulation-info-definition encap-info))))