// Main.hx
@:await
class Main {
@:await static function main() {
var s:String = Macro.expr();
}
@:async static function string() return 'hi';
}
// Macro.hx
class Macro {
public static macro function expr() {
return macro @:await string();
}
}
The above code won't work because the await macro runs first. After that the typer kicks in and transform the macro call to actual expression. As a result, the generated expression (@:await string()) won't get handled by the await macro.
So, are there any workarounds for that?