Changeset 11467


Ignore:
Timestamp:
12/21/08 23:55:41 (13 years ago)
Author:
vvoutilainen
Message:

generate-type-check-for-value is very similar to
generate-type-check-for-variable, clean up
generate-type-check-for-value before combining
the functions.

File:
1 edited

Legend:

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

    r11466 r11467  
    79277927(declaim (ftype (function (t) t) generate-type-check-for-value))
    79287928(defun generate-type-check-for-value (declared-type)
    7929   (cond ((eq declared-type 'SYMBOL)
    7930          (generate-instanceof-type-check-for-value 'SYMBOL))
    7931         ((eq declared-type 'CHARACTER)
    7932          (generate-instanceof-type-check-for-value 'CHARACTER))
    7933         ((eq declared-type 'CONS)
    7934          (generate-instanceof-type-check-for-value 'CONS))
    7935         ((eq declared-type 'HASH-TABLE)
    7936          (generate-instanceof-type-check-for-value 'HASH-TABLE))
    7937         ((fixnum-type-p declared-type)
    7938          (generate-instanceof-type-check-for-value 'FIXNUM))
    7939         ((subtypep declared-type 'STRING)
    7940          (generate-instanceof-type-check-for-value 'STRING))
    7941         ((subtypep declared-type 'VECTOR)
    7942          (generate-instanceof-type-check-for-value 'VECTOR))
    7943         (t
    7944          nil)))
     7929  (let* ((type-to-use
     7930    (or
     7931     (when (fixnum-type-p declared-type) 'FIXNUM)
     7932     (find-if #'(lambda (type) (eq type declared-type))
     7933        `(SYMBOL CHARACTER CONS HASH-TABLE STREAM))
     7934     (find-if #'(lambda (type) (subtypep declared-type type))
     7935        `(STRING VECTOR)))))
     7936    (when type-to-use
     7937      (generate-instanceof-type-check-for-value type-to-use))))
    79457938
    79467939(defun p2-the (form target representation)
Note: See TracChangeset for help on using the changeset viewer.