Changeset 297
- Timestamp:
- Jan 15, 2004, 12:18:32 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/ccl/level-1/l1-typesys.lisp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ccl/level-1/l1-typesys.lisp
r279 r297 1366 1366 1367 1367 (eval-when (:compile-toplevel :execute) 1368 (defconstant type-cache-size (ash 1 7))1368 (defconstant type-cache-size (ash 1 12)) 1369 1369 (defconstant type-cache-mask (1- type-cache-size))) 1370 1370 … … 3223 3223 (values nil t)))) 3224 3224 3225 (defun find-class-intersection (c1 c2) 3226 (labels ((walk-subclasses (class f) 3227 (dolist (sub (class-direct-subclasses class)) 3228 (walk-subclasses sub f)) 3229 (funcall f class))) 3230 (let* ((intersection nil)) 3231 (walk-subclasses c1 #'(lambda (c) 3232 (when (subclassp c c2) 3233 (pushnew (%class.ctype c) intersection)))) 3234 (when intersection 3235 (%type-union intersection))))) 3236 3225 3237 (define-type-method (class :simple-intersection) (type1 type2) 3226 3238 (assert (not (eq type1 type2))) … … 3229 3241 (if (and class1 class2) 3230 3242 (cond ((subclassp class1 class2) 3231 (values type1 t))3243 type1) 3232 3244 ((subclassp class2 class1) 3233 (values type2 t)) 3234 (t (values nil t))) 3235 (values nil t)))) 3245 type2) 3246 ;;; In the STANDARD-CLASS case where neither's 3247 ;;; a subclass of the other, there may be 3248 ;;; one or mor classes that're a subclass of both. We 3249 ;;; -could- try to find all such classes, but 3250 ;;; punt instead. 3251 (t (if (and (typep class1 'standard-class) 3252 (typep class2 'standard-class)) 3253 (find-class-intersection class1 class2) 3254 *empty-type*))) 3255 nil))) 3256 3257 (define-type-method (class :complex-subtypep-arg2) (type1 class2) 3258 (if (and (intersection-ctype-p type1) 3259 (> (count-if #'class-ctype-p (intersection-ctype-types type1)) 1)) 3260 (values nil nil) 3261 (invoke-complex-subtypep-arg1-method type1 class2 nil t))) 3262 3263 (define-type-method (class :complex-subtypep-arg1) (type1 type2) 3264 (if (and (function-ctype-p type2) 3265 (eq type1 (specifier-type 'function)) 3266 (function-ctype-wild-args type2) 3267 (eq *wild-type* (function-ctype-returns type2))) 3268 (values t t) 3269 (values nil t))) 3236 3270 3237 3271 (define-type-method (class :unparse) (type)
Note:
See TracChangeset
for help on using the changeset viewer.
