Changeset 12067
- Timestamp:
- 07/27/09 20:10:46 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/src/org/armedbear/lisp/clos.lisp
r12042 r12067 1970 1970 ;; methods, along with the predefined initialization argument :ALLOW-OTHER-KEYS." 1971 1971 ;; 7.1.2 1972 #+nil 1973 (defun check-initargs ( classinitargs)1972 1973 (defun check-initargs (instance shared-initialize-param initargs) 1974 1974 (when (oddp (length initargs)) 1975 1975 (error 'program-error 1976 1976 :format-control "Odd number of keyword arguments.")) 1977 1977 (unless (getf initargs :allow-other-keys) 1978 (let ((slots (%class-slots class))) 1978 (let ((methods (compute-applicable-methods #'shared-initialize 1979 (if initargs 1980 `(,instance ,shared-initialize-param ,@initargs) 1981 (list instance shared-initialize-param)))) 1982 (slots (%class-slots (class-of instance)))) 1979 1983 (do* ((tail initargs (cddr tail)) 1980 1984 (initarg (car tail) (car tail))) 1981 1985 ((null tail)) 1982 1986 (unless (or (valid-initarg-p initarg slots) 1987 (valid-methodarg-p initarg methods) 1983 1988 (eq initarg :allow-other-keys)) 1984 1989 (error 'program-error … … 1987 1992 1988 1993 ;; FIXME 1989 (defun check-initargs (class initargs) 1990 (declare (ignore class initargs))) 1994 1995 ;(defun check-initargs (class initargs) 1996 ; (declare (ignore class initargs))) 1997 1998 (defun valid-methodarg-p (initarg methods) 1999 (dolist (method methods nil) 2000 (let ((valid-initargs (method-lambda-list method))) 2001 (when (find (symbol-value initarg) valid-initargs :test #'string=) 2002 (return t))))) 1991 2003 1992 2004 (defun valid-initarg-p (initarg slots) … … 2013 2025 (setf default-initargs (append default-initargs (list key (funcall fn)))))) 2014 2026 (setf initargs (append initargs default-initargs))))) 2015 (check-initargs class initargs) 2027 2016 2028 (let ((instance (std-allocate-instance class))) 2029 (check-initargs instance t initargs) 2017 2030 (apply #'initialize-instance instance initargs) 2018 2031 instance)) … … 2099 2112 (mapcar #'%slot-definition-name 2100 2113 (%class-slots (class-of new)))))) 2101 (check-initargs (class-of new)initargs)2114 (check-initargs new added-slots initargs) 2102 2115 (apply #'shared-initialize new added-slots initargs))) 2103 2116 … … 2128 2141 property-list 2129 2142 &rest initargs) 2130 (check-initargs (class-of instance)initargs)2143 (check-initargs instance added-slots initargs) 2131 2144 (apply #'shared-initialize instance added-slots initargs)) 2132 2145
Note: See TracChangeset
for help on using the changeset viewer.