Emit proper code for arrays that contain circular references

This commit is contained in:
jgarcia 2006-05-29 12:36:36 +00:00
parent 20ab0394db
commit 2a55488e7e

View file

@ -77,12 +77,19 @@ printer and we should rather use MAKE-LOAD-FORM."
(return-from make-load-form (maybe-quote object)))
(typecase object
(array
(values `(make-array ',(array-dimensions object)
:element-type ',(array-element-type object)
:adjustable ',(adjustable-array-p object)
:initial-contents ',(loop for i from 0 below (array-total-size object)
collect (row-major-aref object i)))
init))
(let ((init-forms '()))
(values `(make-array ',(array-dimensions object)
:element-type ',(array-element-type object)
:adjustable ',(adjustable-array-p object)
:initial-contents
',(loop for i from 0 below (array-total-size object)
collect (let ((x (row-major-aref object i)))
(if (need-to-make-load-form-p x)
(progn (push `(setf (row-major-aref ,object ,i) ,x)
init-forms)
0)
x))))
(and init-forms `(progn ,@init-forms)))))
(cons
(values `(cons ,(maybe-quote (car object)) nil)
(and (rest object) `(rplacd ,(maybe-quote object) ,(maybe-quote (cdr object))))))