haxe icon indicating copy to clipboard operation
haxe copied to clipboard

MacroApi cleanup for Haxe 5

Open Simn opened this issue 1 year ago • 2 comments

Still some TODOs.

Closes #11431

Simn avatar Dec 18 '23 09:12 Simn

Since adding optional fields always incurs a marginal risk for breaking user code, might I use this opportunity to request also adding the positions of other names currently not exposed?

  1. The position of the type name in BaseType and TypeDefinition.
  2. The position of the field name in Field, ObjectField, EnumField and ClassField.

I see that some of these are already encoded in an unspecified name_pos (i.e. in ObjectField and EnumField as far as I can tell), but it would be nice to have proper access and generally be able to define / refer to finer grained positions for the sake of not coloring everything red.

FWIW I think in the types from haxe.macro.Type it could even be non-optional, because to the best of my knowledge constructing types by hand is not really a thing.

back2dos avatar Feb 03 '24 09:02 back2dos

I'll have to check all this again, I thought this name_pos business was mostly for enum instances, where we can't access the value from Haxe anyway. But yes I'd like to clean all this up and provide all the information to macros.

Simn avatar Feb 03 '24 15:02 Simn