jan_flanders

Untitled

Nov 11th, 2012
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import haxe.macro.Expr;
  2. import haxe.macro.Context;
  3. class MyTrace
  4. {
  5.     @:macro static public function mtrace(e:haxe.macro.Expr)
  6.     {
  7.         var e2 = {expr:EConst(CString(Std.string(e))),pos:Context.currentPos()};
  8.         return macro trace( $e2 + ' ' + $e);
  9.     }
  10. }
  11. class Main
  12. {
  13.     public static function main()
  14.     {
  15.         var obj = {nr:10};
  16.         MyTrace.mtrace(obj.nr);
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment