SHOW:
|
|
- or go back to the newest paste.
| 1 | import haxe.macro.Expr; | |
| 2 | import haxe.macro.Context; | |
| 3 | import scuts.macro.Print.exprStr; | |
| 4 | class MyTrace | |
| 5 | {
| |
| 6 | @:macro static public function mtrace(e:haxe.macro.Expr) | |
| 7 | - | var e2 = {expr:EConst(CString(Std.string(e))),pos:Context.currentPos()};
|
| 7 | + | |
| 8 | var e2 = {expr:EConst(CString(exprStr(e))),pos:Context.currentPos()};
| |
| 9 | return macro trace( $e2 + ' ' + $e); | |
| 10 | } | |
| 11 | } | |
| 12 | class Main | |
| 13 | {
| |
| 14 | public static function main() | |
| 15 | {
| |
| 16 | var obj = {nr:10};
| |
| 17 | MyTrace.mtrace(obj.nr); | |
| 18 | } | |
| 19 | } |