Changeset 12098


Ignore:
Timestamp:
08/13/09 13:14:58 (12 years ago)
Author:
ehuelsmann
Message:

Structure access referential integrity checks.

Pointed out by piso.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/src/org/armedbear/lisp/defstruct.lisp

    r12078 r12098  
    345345          (t
    346346           `((declaim (ftype (function * ,type) ,accessor-name))
    347              (defun ,accessor-name (instance) (structure-ref instance ,index))
     347             (defun ,accessor-name (instance)
     348               (structure-ref (the ',*dd-name* instance) ,index))
    348349             (define-source-transform ,accessor-name (instance)
    349350               ,(if (eq type 't)
    350                     ``(structure-ref ,instance ,,index)
    351                     ``(the ,',type (structure-ref ,instance ,,index)))))))))
     351                    ``(structure-ref (the ,',*dd-name* ,instance) ,,index)
     352                    ``(the ,',type
     353                        (structure-ref (the ,',*dd-name* ,instance) ,,index)))))))))
    352354
    353355(defun define-writer (slot)
     
    369371          (t
    370372           `((defun (setf ,accessor-name) (value instance)
    371                (structure-set instance ,index value))
     373               (structure-set (the ',*dd-name* instance) ,index value))
    372374             (define-source-transform (setf ,accessor-name) (value instance)
    373                `(structure-set ,instance ,,index ,value)))))))
     375               `(structure-set (the ,',*dd-name* ,instance)
     376                               ,,index ,value)))))))
    374377
    375378(defun define-access-functions ()
Note: See TracChangeset for help on using the changeset viewer.