anon_class_test.gravity 642 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #unittest {
  2. name: "Anonimous class test";
  3. result: 666
  4. };
  5. var Window1;
  6. class _Window1 {
  7. var button;
  8. class _Button1 {
  9. func test() {
  10. return 777;
  11. }
  12. }
  13. func setup() {
  14. button = _Button1();
  15. button.bind("action", {var a = Window1.action(); return a;})
  16. }
  17. func action() {
  18. return 666;
  19. }
  20. }
  21. func main() {
  22. Window1 = _Window1();
  23. Window1.setup();
  24. var test = Window1.action();
  25. var button = Window1.button;
  26. button.test();
  27. var temp = button.action();
  28. // force GC to run
  29. var l = [1,2,3];
  30. return temp;
  31. }