-
Notifications
You must be signed in to change notification settings - Fork 9
Make variables pass through expression preprocessors first #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The static vars thing is a tough problem since it works differently for each target, but this a good start. I think how static variable assignments are transformed should be handled as a Maybe I'm missing something, but |
|
I'm afraid some API needs to be changed in order to make this possible because preprocessors take the ClassFuncData class as an argument, that's also why I had to use a virtual ClassFuncData before. Thank you for the suggestions, I'll notify once everything is ready. |
Take a look at https://github.com/Davvex87/reflaxe.lua/tree/feature/reflaxe-new-statics for a working implementation example
|
Alrighty, I'd say it's ready. I've done some testing with https://github.com/Davvex87/reflaxe.lua/tree/feature/reflaxe-new-statics and it generates stuff as expected. |
Read #45 for more information.
In short, static variables do not have their default expression passed through preprocessors like functions do, causing unintended behavior in certain classes.
The fix was basically just create a "virtual" ClassFuncData object and then pass that to the preprocessors, extract the final modified expr, do some final processing and overwrite the expr() function in the ClassVarData to return our fixed expression.
Fixes #45, I opened it 11 hours ago and I never expected to be able to fix this issue any time soon, guess I out-did myself, whoops...