Changeset 11462


Ignore:
Timestamp:
12/21/08 11:46:57 (13 years ago)
Author:
vvoutilainen
Message:

Clean up generate-type-check-for-variable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp

    r11461 r11462  
    480480(defknown generate-type-check-for-variable (t) t)
    481481(defun generate-type-check-for-variable (variable)
    482   (let ((declared-type (variable-declared-type variable)))
    483     (cond ((eq declared-type :none)) ; Nothing to do.
    484           ((eq declared-type 'SYMBOL)
    485            (generate-instanceof-type-check-for-variable variable 'SYMBOL))
    486           ((eq declared-type 'CHARACTER)
    487            (generate-instanceof-type-check-for-variable variable 'CHARACTER))
    488           ((eq declared-type 'CONS)
    489            (generate-instanceof-type-check-for-variable variable 'CONS))
    490           ((eq declared-type 'HASH-TABLE)
    491            (generate-instanceof-type-check-for-variable variable 'HASH-TABLE))
    492           ((fixnum-type-p declared-type)
    493            (generate-instanceof-type-check-for-variable variable 'FIXNUM))
    494           ((subtypep declared-type 'STRING)
    495            (generate-instanceof-type-check-for-variable variable 'STRING))
    496           ((subtypep declared-type 'VECTOR)
    497            (generate-instanceof-type-check-for-variable variable 'VECTOR))
    498           ((eq declared-type 'STREAM)
    499            (generate-instanceof-type-check-for-variable variable 'STREAM))
    500           (t
    501            nil))))
     482  (let* ((declared-type (variable-declared-type variable))
     483   (type-to-use
     484    (if (eq declared-type :none) nil
     485        (or
     486         (when (fixnum-type-p declared-type) 'FIXNUM)
     487         (find-if #'(lambda (type) (eq type declared-type))
     488      `(SYMBOL CHARACTER CONS HASH-TABLE STREAM))
     489         (find-if #'(lambda (type) (subtypep declared-type type))
     490      `(STRING VECTOR))))))
     491    (when type-to-use
     492      (generate-instanceof-type-check-for-variable variable type-to-use))))
    502493
    503494(defknown maybe-generate-type-check (t) t)
Note: See TracChangeset for help on using the changeset viewer.