Closed NQNStudios closed 1 week ago
This stems from poor data design, but changing this would break too many things for little benefit. There are probably multiple ways to setup the AST data to choke the printer, and I don't think this is worth looking into. I'll add a documentation note about this.
When an EVars ExprDef has some final vars in it, and some mutable vars in it, only the mutability of the first var will be printed by haxe.macr.Printer.
I would expect this:
to print
final finalVar; var mutableVar;
. Even though this wouldn't parse back in as the original single ExprDef, this is the Haxe that will compile with the same result as the ExprDef.I know this case is weird because raw haxe wouldn't produce the case described. You can only produce it with a macro by making an ExprDef manually.
But the problem is right here: https://github.com/HaxeFoundation/haxe/blob/760c0dd9972abadceba4e72edb1db13b2a4fb315/std/haxe/macro/Printer.hx#L255