Adjust reference PRINT-OBJECTs to not error on unbound slots

This commit is contained in:
John Lorentzson 2025-05-22 12:21:51 +02:00
parent 3c8835eb7b
commit 57c2978b71

View file

@ -13,7 +13,9 @@
(defmethod print-object ((object reference-constant) stream)
(print-unreadable-object (object stream :type t)
(format stream "~D" (ref-value object))))
(format stream "~A" (if (slot-boundp object '%value)
(ref-value object)
"?"))))
(defmethod ref= ((a reference-constant) (b reference-constant))
(= (value a) (value b)))
@ -23,4 +25,9 @@
(defmethod print-object ((object reference-variable) stream)
(print-unreadable-object (object stream :type t)
(format stream "@~D" (ref-index object))))
(when (slot-boundp object '%name)
(write-string (name object) stream))
(when (and (slot-boundp object '%name) (slot-boundp object '%index))
(write-string " " stream))
(when (slot-boundp object '%index)
(format stream "@~A" (ref-index object)))))