package; #if macro import haxe.macro.Context; import haxe.macro.Type; #end function main() { } #if macro class MacroClass { public static function start() { printTypedExpr(Context.getMainExpr()); Context.onAfterTyping(function(modules: Array) { printTypedExpr(Context.getMainExpr()); }); Context.onGenerate(function(types: Array) { printTypedExpr(Context.getMainExpr()); if(Context.getAllModuleTypes().length == types.length) { trace("Module type list length == types.length"); } else { trace("Module types length != types.length"); } }); Context.onAfterGenerate(function() { printTypedExpr(Context.getMainExpr()); }); } static function printTypedExpr(te: Null, ?pos:haxe.PosInfos) { if(te == null) { haxe.Log.trace("null", pos); } else { haxe.Log.trace(haxe.macro.TypedExprTools.toString(te, true), pos); } } } #end