Main.hx 475 B

12345678910111213141516171819202122232425262728293031
  1. class Main {
  2. static var doThings : Foo -> Void;
  3. static function main() {
  4. var foo = new Foo();
  5. doThings = (foo -> doThingsImpl(foo));
  6. doThings(foo);
  7. }
  8. static function doThingsImpl(foo) {
  9. foo.doWithBar();
  10. $type(foo);
  11. $type(foo.doWithBar);
  12. if (foo != null) trace(foo);
  13. $type(foo);
  14. $type(foo.doWithBar);
  15. }
  16. }
  17. class Foo {
  18. public function new() {}
  19. public function doWithBar(?bar:Bar) {
  20. trace(bar);
  21. }
  22. }
  23. @:keep
  24. class Bar {
  25. public function new() {}
  26. }