So I have this static array that's filled by a macro function:
static public var lookup:Array<Int> = LookupBuilder.genArray();
And all over my project, my classes call this other macro function:
LookupBuilder.addValue(42);
LookupBuilder.addValue(1337);
LookupBuilder.addValue(9000);
The idea is that the lookup array will end up looking like this:
static public var lookup:Array<Int> = [42, 1337, 9000];
However, all I get is an empty [] array instead. The reason is rather obvious, the genArray() macro ends up running before those addValue() macros run.
How do deal with this? The only macro thing I managed to get reliably running after addValue() is Context.onGenerate(), but I have no idea how I would go from it to the static lookup assignment.