Opened 12 years ago
Closed 12 years ago
#7967 closed defect (duplicate)
Shrinksafe does not parse legal Javascript correctly
Reported by: | lipik | Owned by: | alex |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | ShrinkSafe | Version: | 1.2.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Here is the schematic of the code that fails for me:
var F = function() { var m_a = function() { return m_b() + 1; }, m_b = function() { return 0; }; return { fa: m_a, f_b: m_b }; };
Upon shrinking-safe, the first usage of m_b (that appears before the definition) is not replaced. I imagine it is because the parser is trying to do everything in one pass.
I apologize if there is a "slow but correct" option that I do not know about - I have only just started using ShrinkSafe? as part of dojo build. This issue forced me to rewrite a lot of functions, since I like to use Crockford's private-closures idiom for singleton objects.
Note: See
TracTickets for help on using
tickets.
Duplicate of #3241. It will probably work if you structure it like so: