deltaluca

Untitled

May 5th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Haxe 0.53 KB | None | 0 0
  1. import haxe.macro.Expr;
  2. import haxe.macro.Context;
  3. import haxe.macro.Printer;
  4.  
  5. class Main {
  6.     macro static function typeName(t:haxe.macro.Expr) {
  7.         return macro $v{(new Printer()).printComplexType(Context.toComplexType(Context.typeof(t)))};
  8.     }
  9.     static function main() {
  10.         trace(typeName(Main)); // Main.#Main
  11.     }
  12. }
  13.  
  14. generated JS (to ensure its all done compile time):
  15.  
  16. (function () { "use strict";
  17. var Main = function() { }
  18. Main.main = function() {
  19.     console.log("Main.#Main");
  20. }
  21. Main.main();
  22. })();
Advertisement
Add Comment
Please, Sign In to add comment