#146 closed defect (fixed)
Compressor does not handle nested functions with identical parameter names correctly
Reported by: | Owned by: | anonymous | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | BuildTools | Version: | 0.1 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
The compressor/ShrinkSafe does not seem to handle nested functions that have identical parameter names in both the inner and function outer functions.
The simplest example is probably:
function(foo) { function(foo) {}; foo; };
which generates:
function(_1){ function(_1){ } foo; }
Notice how the reference to foo
in the body of the outer function does not get converted and the parameters of both functions get the same replacement value _1
.
This is the actual piece of code with which I first noticed the problem:
OLPanTool.prototype.handleMapMouseDown = function(event, map) { var pt = event.getCursorPosition(); map.startPan(pt.x,pt.y); var realThis = this; OLWindowManager.getDocument().addEventListener('mousemove', function(event) { return realThis.drag(event, map); }); OLWindowManager.getDocument().addEventListener('mouseup', function(event) { return realThis.release(event, map); }); OLWindowManager.getDocument().addEventListener('mouseout', function(event) { if (!event.getRelatedTarget()) { return realThis.release(event, map); } }); map.setMapCursor(OLWindowManager.DRAGGING_CURSOR); event.stopPropagation(); };
Change History (3)
comment:1 Changed 15 years ago by
Milestone: | → 0.2release |
---|
comment:2 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
(In [2041]) updates to make the compressor even safer and make shortened names even smaller
fixes #177 fixes #146