DavidRM 47 Report post Posted January 3 Not really a *bug*...but it looks like case statements get compiled to if-then-else statements that aren't "packed". That is, each case statement condition is kept on a single line, not combined with the line ahead of it. Is that by design? -David Share this post Link to post Share on other sites
jarto 428 Report post Posted January 4 Weird. When I test this, the statements are on one line. Share this post Link to post Share on other sites
DavidRM 47 Report post Posted January 4 I'll poke at it some more. I just noticed because I was packing and obfuscating for deployment. Share this post Link to post Share on other sites
jarto 428 Report post Posted January 5 For deployment, you can also add extra complexity against preying eyes by using Google's closure-compiler. Download the latest binary from: https://github.com/google/closure-compiler/wiki/Binary-Downloads Uncheck "Embed Javascripg into HTML file" in Project options Select both Code packing and Code obfuscation Build Run closure-compiler on the generated main.js: java -jar closure-compiler.jar --js main.js --js_output_file mainp.js And then replace main.js with mainp.js. The compiler will give some warnings about unreachable code but they are safe to ignore. 2 DavidRM and lynkfs reacted to this Share this post Link to post Share on other sites
DavidRM 47 Report post Posted January 5 I wonder if the not-packing is related to ASM blocks? I have no idea. I can scroll through my packed-and-obfuscated JS file and see blocks like this: I think that's from RTL code, not mine. This is from mine: I don't know that it makes a lot of difference, but there it is. -David Share this post Link to post Share on other sites
jarto 428 Report post Posted January 6 Now I can reproduce the problem. If you compare against string values, they are split on separate lines: case Trunc(Now) of 1: WriteLn('One'); 2: WriteLn('Two'); 3: WriteLn('One'); else WriteLn('Something else'); end; case IntToStr(Trunc(Now)) of '1': WriteLn('One'); '2': WriteLn('Two'); '3': WriteLn('One'); else WriteLn('Something else'); end; case IntToStr(Trunc(Now)) of "1": WriteLn('One'); "2": WriteLn('Two'); "3": WriteLn('One'); else WriteLn('Something else'); end; That first one is compressed on one line. Other ones are split on multiple lines. 1 DavidRM reacted to this Share this post Link to post Share on other sites
DavidRM 47 Report post Posted January 8 On 1/5/2019 at 3:59 AM, jarto said: For deployment, you can also add extra complexity against preying eyes by using Google's closure-compiler. Download the latest binary from: https://github.com/google/closure-compiler/wiki/Binary-Downloads Uncheck "Embed Javascripg into HTML file" in Project options Select both Code packing and Code obfuscation Build Run closure-compiler on the generated main.js: java -jar closure-compiler.jar --js main.js --js_output_file mainp.js And then replace main.js with mainp.js. The compiler will give some warnings about unreachable code but they are safe to ignore. @jarto That does add a bit more obfuscation, yup yup. Thanks! 😃 -David Share this post Link to post Share on other sites