Fix bug with :slot access

This commit is contained in:
~keith 2022-02-22 15:35:49 +00:00
parent 914d5dfcdc
commit 7d85c12f3a
Signed by: keith
GPG key ID: 5BEBEEAB2C73D520

View file

@ -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)