BUGFIX: Fix proxy compilation for edge cases
This change fixes proxy compilation for certain cases where "class" was used as a string in multi-line quoted strings or within comments.
Resolves: #1835
Dang… seems as if the extra-weird testcase by @albe makes it fail… 🙈 What to do about that?
Dang… seems as if the extra-weird testcase by @albe makes it fail… 🙈 What to do about that?
Sorry! 🙈 Maybe document as DONT WRITE COMMENTS BETWEEN THE CLASS KEYWORD AND YOUR CLASSNAME THAT CONTAINS THE WORD "CLASS", STUPID! cuts it? 😂
For real though, Christian is onto it - see the comment
I took a new approach: Instead of using a regex replacing the class name, I regenerate the beginning of the source code until the class name appears by rendering the respective tokens. Usually, this amount of code until the class name appears, will be relatively short, so I guess that taking this approach is feasible in terms of speed.
I also added a new unit test cases which covers more edge cases than the ones we already had in mind.
I tested this patch with a real application and ran all tests, so this should hopefully work in all cases.
Is it okay to target this to 8.3 and 9.0 or do I need to port this to earlier versions, too?
Is it okay to target this to 8.3 and 9.0 or do I need to port this to earlier versions, too?
I think 8.3 is fine, but if you really like, it could even go into ealier releases. Not a must, though.
This fix is now targeted to 8.0.