Macro.hx 695 B

123456789101112131415161718192021222324252627
  1. import haxe.macro.Context;
  2. import haxe.macro.Expr;
  3. class Macro {
  4. static function build() {
  5. var pos = Context.currentPos();
  6. Context.defineModule(Context.getLocalModule(), [{
  7. pos: pos,
  8. pack: [],
  9. name: "A",
  10. kind: TDAbstract(macro : Int),
  11. fields: [
  12. {
  13. pos: pos,
  14. name: "new",
  15. access: [APublic],
  16. kind: FFun({
  17. args: [],
  18. ret: null,
  19. expr: macro this = 1,
  20. })
  21. }
  22. ]
  23. }]);
  24. return macro : A;
  25. }
  26. }