20 lines
411 B
Haxe
Raw Permalink Normal View History

2025-01-22 16:18:30 +01:00
package zui;
import haxe.macro.Context;
import haxe.macro.Expr;
import haxe.macro.ExprTools;
class Id {
static var i = 0;
macro public static function pos(): Expr {
return macro $v{i++};
}
macro public static function handle(ops: Expr = null): Expr {
var code = "zui.Zui.Handle.global.nest(zui.Id.pos()," + ExprTools.toString(ops) + ")";
return Context.parse(code, Context.currentPos());
}
}