Minified Code Producing Error - Solved #4165
Replies: 1 comment
-
Posted at 2014-10-22 by @gfwilliams Great - glad you got it sorted. Thanks for letting me know - I had no idea the closure compiler did that - it could be a recent addition. Maybe it adds a bit more urgency to the label implementation :) Either that or I should get the offline minifier done. Posted at 2014-10-22 by DaveNI It really surprised me - I thought simple minification only removed comments/white space & renamed local variables/function names. I don't mind the lack of support for labels - I don't tend to use them anyway, too much like goto. Posted at 2014-10-22 by @allObjects Really weird things happen when throwing minification and Espruino together - see http://forum.espruino.com/conversations/256957/ - where all of a sudden the if does not work anymore... nor the try-catch... and only the addition of some application-useless but minification-tricking (noise) code get's the things back to work again. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2014-10-22 by DaveNI
I was getting errors in some minified code (simple minification) and have identified the issue:
My function had two return statements - one within a loop, the other at the end of the function (sloppy , I know!!).
This caused the minifier to output a labelled break which isn't supported by Espruino.
Refactoring the function to have only one return statement solved the issue - hopefully this is of help to someone else.
(edit: Probably should have been posted this in the Javascript forum)
Beta Was this translation helpful? Give feedback.
All reactions