Minifier variable renaming is buggy
nojb opened this issue · 7 comments
nojb commented
nojb commented
Is this bug with jsoo_minify only ? if so, the fix is #1351
No, we detected a bug in the code generated by js_of_ocaml
that is introduced in the minification phase (the bug is not present when using --pretty
). We are trying to extract a small reproduction, but have been unsuccessful so far.
mlasson commented
FYI, here's the excerpt of the generated code showing the code
...,bRn=function(d,c,b){var
e=d?d[1]:0,f=e?q(b,bRo):e;if(f)return f;function
a(c){return Ii(0,b)?1:0}if(c){var
g=c[1];try{_R(g,b)}catch(a){return a(0)}return 1}return a(0)},
...
the a in catch(a) is the compilation of a "try ... with _ -> ..."
mlasson commented
It seems to fix the bug indeed. Thanks a lot !
I am not 100% sure though; the bug was fragile; we may get around the
bug because we assign the variable differently with your change.