Closed xem closed 7 years ago
The reason behind this issue is that \
as a token is not correctly escaped. So it is treated as an escaping sequence - \x
with your code - instead of being decoded as a single \
.
Even worse, the safeguard (automatic unpacking at the end of the routine) and linked unit tests failed to catch that.
This may prove be quite tricky to fix entirely. I got a quickfix to solve your case, but it would invalidate the replacement in regPack.js:515-557
. Performing the escaping at the end of the routine, instead of the beginning, could do the trick, however it also needs to figure out when not to use \
as a token as it basically costs double compared to other characters.
As a workaround, you could revert to v4.0.1, it does not suffer from the issue and compresses the sample code to 1017b.
thanks for the analysis. Don't worry for my case, my code has changed since this bug and doesn't enable the '\' token anymore when I pack it. Cheers and good luck!
Moved the escaping after tokens are assigned. This does the trick.
Hello,
I'm trying to pack the following code:
Regpack 5.0.0 produced the following output (with the tie 2/1/0)
When I try to execute that, my browser tells me:
more precisely, RegPack uses the token "\" for compression, but when \ is placed before a "x", it breaks the string:
I tried to exclude "\" from the "reassign variables except..." field but it didn't work. The quick fix will probably be to rename my var x into something else, but I thought you'd like to know this issue :)
Thanks!