Changeset 6104


Ignore:
Timestamp:
Mar 28, 2007, 6:50:52 AM (13 years ago)
Author:
gb
Message:

Deal with the fact that method types are sometimes FOREIGN-TYPEs and
somethimes foreign-type specifiers.

Canonicalize method signatures via foreign type equality.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/objc-gf/ccl/examples/bridge.lisp

    r6080 r6104  
    603603                        (car (objc-message-info-methods info)))))
    604604           (if (getf (objc-message-info-flags info) :returns-structure)
    605              (values `(,var ,(unparse-foreign-type rtype))
     605             (values `(,var ,(if (typep rtype 'foreign-type)
     606                                 (unparse-foreign-type rtype)
     607                                 rtype))
    606608                     `(send/stret ,var ,@(rest form)))
    607609             (if errorp
     
    615617                        (car (objc-message-info-methods info)))))
    616618           (if (getf (objc-message-info-flags info) :returns-structure)
    617              (values `(,var ,(unparse-foreign-type rtype))
     619             (values `(,var ,(if (typep rtype 'foreign-type)
     620                                 (unparse-foreign-type rtype)
     621                                 rtype))
    618622                     `(send-super/stret ,var ,@(rest form)))
    619623             (if errorp
     
    685689  ;; Use objc-msg-send-stret for all methods that return
    686690  ;; record types.
    687   (typep result-type 'foreign-record-type))
     691  (or (typep result-type 'foreign-record-type)
     692      (and (not (typep result-type 'foreign-type))
     693           (typep (parse-foreign-type result-type) 'foreign-record-type))))
    688694
    689695(defvar *objc-method-signatures* (make-hash-table :test #'equal))
     
    848854             (protocol-methods)
    849855             (signature-alist ()))
    850         (dolist (m methods)
    851           (let* ((signature (ensure-method-signature m)))
    852             (pushnew signature signatures :test #'equal)
     856        (labels ((signatures-equal (xs ys)
     857                   (and xs
     858                        ys
     859                        (do* ((xs xs (cdr xs))
     860                              (ys ys (cdr ys)))
     861                             ((null xs) (null ys))
     862                          (unless (foreign-type-= (ensure-foreign-type (car xs))
     863                                                  (ensure-foreign-type (car ys)))
     864                            (return nil))))))
     865            (dolist (m methods)
     866              (let* ((signature (ensure-method-signature m)))
     867                (pushnew signature signatures :test #'signatures-equal)
    853868            (if (getf (objc-method-info-flags m) :protocol)
    854869              (push m protocol-methods)
    855               (let* ((pair (assoc signature signature-alist :test #'equal)))
     870              (let* ((pair (assoc signature signature-alist :test #'signatures-equal)))
    856871                (if pair
    857872                  (push m (cdr pair))
    858                   (push (cons signature (list m)) signature-alist))))))
     873                  (push (cons signature (list m)) signature-alist)))))))
    859874        (setf (objc-message-info-ambiguous-methods message-info)
    860875              (mapcar #'cdr
     
    11651180          (let* ((protocol-name (objc-method-info-class-name method)))
    11661181            (clauses `((let* ((,protocol (lookup-objc-protocol ,protocol-name))
    1167                               (,protocol-address (and ,protocol (protocol-address ,protocol))))
     1182                              (,protocol-address (and ,protocol (objc-protocol-address ,protocol))))
    11681183                         (and ,protocol-address
    11691184                              (objc-message-send ,receiver
Note: See TracChangeset for help on using the changeset viewer.