jak-project/goal_src/test/test-set-self.gc
water111 c9b53d51ff
Compiler Cleanup (Part 2) (#56)
* check on windows

* fix windows build

* version test

* clean up - will it work on windows

* fix formatting
2020-09-25 21:11:27 -04:00

17 lines
494 B
Common Lisp

(deftype self-test-type (basic)
((self basic))
)
(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 was a tricky thing to get right in the old compiler, so its worth testing.
(set! (-> obj self) obj)
obj
)
)
(let ((temp (new 'global 'self-test-type)))
(format #t "~A~%" (eq? temp (-> temp self)))
)
0