Macro2.hx 815 B

1234567891011121314151617181920212223242526272829303132333435
  1. import haxe.macro.Context;
  2. @:deprecated
  3. typedef DeprecatedType = String;
  4. class Macro2 {
  5. public static function init() {
  6. Context.onAfterTyping(afterTyping);
  7. }
  8. static function afterTyping(_) {
  9. Context.warning(("1" :DeprecatedType), Context.currentPos());
  10. Context.warning("2", Context.currentPos());
  11. Context.warning("3", Context.currentPos());
  12. var messages = Context.getMessages();
  13. var order = Lambda.fold(messages, (msg, acc) -> switch msg {
  14. case Warning(w, _) if (w.length == 1): acc + w;
  15. case Info(_, _): acc + 'i';
  16. case _: acc;
  17. }, "") + "|";
  18. Context.filterMessages(function(msg) {
  19. switch msg {
  20. case Warning(w, _) if (w.length == 1): order += w;
  21. case Info(_, _): order += 'i';
  22. case _:
  23. }
  24. return true;
  25. });
  26. Context.warning(order, Context.currentPos());
  27. }
  28. }