Changeset 4561


Ignore:
Timestamp:
10/28/03 23:25:12 (18 years ago)
Author:
piso
Message:

SETF: resolve autoload of FOO (if any) before trying to expand (SETF (FOO ...) ...).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/setf.lisp

    r4440 r4561  
    22;;;
    33;;; Copyright (C) 2003 Peter Graves
    4 ;;; $Id: setf.lisp,v 1.35 2003-10-17 19:10:19 piso Exp $
     4;;; $Id: setf.lisp,v 1.36 2003-10-28 23:25:12 piso Exp $
    55;;;
    66;;; This program is free software; you can redistribute it and/or
     
    8383      (setq access-forms (cons access-form access-forms)))))
    8484
    85 
    8685(defmacro setf (&rest args)
    8786  (let ((count (length args)))
     
    9291        (if (atom place)
    9392            `(setq ,place ,value-form)
    94             (multiple-value-bind (dummies vals newval setter getter)
    95               (get-setf-expansion place nil)
    96               (let ((inverse (get (car place) 'setf-inverse)))
    97                 (if (and inverse (eq inverse (car setter)))
    98                     (if (functionp inverse)
    99                         `(funcall ,inverse ,@(cdr place) ,value-form)
    100                         `(,inverse ,@(cdr place) ,value-form))
    101                     `(let* (,@(mapcar #'list dummies vals))
    102                        (multiple-value-bind ,newval ,value-form
    103                          ,setter))))))))
     93            (progn
     94              (when (symbolp (car place))
     95                (resolve (car place)))
     96              (multiple-value-bind (dummies vals newval setter getter)
     97                (get-setf-expansion place)
     98                (let ((inverse (get (car place) 'setf-inverse)))
     99                  (if (and inverse (eq inverse (car setter)))
     100                      (if (functionp inverse)
     101                          `(funcall ,inverse ,@(cdr place) ,value-form)
     102                          `(,inverse ,@(cdr place) ,value-form))
     103                      `(let* (,@(mapcar #'list dummies vals))
     104                         (multiple-value-bind ,newval ,value-form
     105                           ,setter)))))))))
    104106     ((oddp count)
    105107      (error "odd number of args to SETF"))
Note: See TracChangeset for help on using the changeset viewer.