Fix bug with :slot access
This commit is contained in:
parent
914d5dfcdc
commit
7d85c12f3a
1 changed files with 10 additions and 8 deletions
|
@ -14,14 +14,16 @@
|
|||
(let ((expr root))
|
||||
(loop for entry on forms
|
||||
for form = (car entry)
|
||||
do (setf expr
|
||||
(cond ((consp form) `(,(car form) ,expr ,@(cdr form)))
|
||||
((eq form :slot) (prog1
|
||||
`(slot-value ,expr ',(cadr entry))
|
||||
(rplacd entry (cddr entry))))
|
||||
((symbolp form) `(,form ,expr))
|
||||
(t (error "Unexpected form ~S" form))
|
||||
)))
|
||||
and prev-form = nil then form
|
||||
unless (eq prev-form :slot)
|
||||
do (setf expr
|
||||
(cond ((consp form) `(,(car form) ,expr ,@(cdr form)))
|
||||
((eq form :slot) (prog1 `(slot-value ,expr ',(cadr entry))
|
||||
(unless (cadr entry)
|
||||
(error "Missing slot name"))))
|
||||
((symbolp form) `(,form ,expr))
|
||||
(t (error "Unexpected form ~S" form)))))
|
||||
;(format t "~S => ~S~%" `(O! ,root ,@forms) expr)
|
||||
expr))
|
||||
|
||||
(defun read-construct (stream char arg)
|
||||
|
|
Loading…
Reference in a new issue