Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import haxe.macro.Expr;
- import haxe.macro.Context;
- import haxe.macro.Printer;
- class Main {
- macro static function typeName(t:haxe.macro.Expr) {
- return macro $v{(new Printer()).printComplexType(Context.toComplexType(Context.typeof(t)))};
- }
- static function main() {
- trace(typeName(Main)); // Main.#Main
- }
- }
- generated JS (to ensure its all done compile time):
- (function () { "use strict";
- var Main = function() { }
- Main.main = function() {
- console.log("Main.#Main");
- }
- Main.main();
- })();
Advertisement
Add Comment
Please, Sign In to add comment