jak-project/test/old_goal_tests/tests/test-set-self.gc
2020-08-22 22:32:18 -04:00

20 lines
479 B
Plaintext

(test-setup 12 #f)
(deftype self-test-type (basic)
((self self-test-type))
)
(defmethod new self-test-type ((allocation symbol) (type-to-make type))
(let ((obj (object-new)))
;; here the register of obj is used both as a "real" pointer and a GOAL pointer in the same instruction.
;; this is a special case in the emitter.
(set! (-> obj self) obj)
obj
)
)
(let ((temp (new 'global 'self-test-type)))
(expect-true (eq? temp (-> temp self)))
)
12