jak-project/test/goalc/source_templates/with_game/test-behaviors.gc
water111 e251f8b2d9
Support Behaviors (#678)
* temp

* working, but type pass got really slow

* clean up

* changelog and flip order

* clean up and add tests

* fix zero size array

* handle lambdas correctly

* another windows fix
2021-07-04 16:54:07 -04:00

28 lines
664 B
Common Lisp

(deftype behavior-test-type (basic)
((foo int))
(:methods
(test (_type_ basic) int :behavior behavior-test-type)
)
)
(defmethod test behavior-test-type ((obj behavior-test-type) (arg0 basic))
(format #t "method obj: ~D self: ~D~%" (-> obj foo) (-> self foo))
0
)
(defbehavior test-bfunc behavior-test-type ((arg0 basic))
(format #t "function self: ~D~%" (-> self foo))
)
(let ((obj1 (new 'static 'behavior-test-type :foo 123))
(obj2 (new 'static 'behavior-test-type :foo 456)))
(with-pp
(protect (pp)
(set! pp (the process obj1))
(test-bfunc #f)
(test obj2 #f)
)
)
)
0