Invalid removal of parentheses of immediately called function #28

Closed
rivol opened this Issue Apr 6, 2012 · 3 comments

Comments

Projects
None yet
2 participants
@rivol

rivol commented Apr 6, 2012

Consider this JS snippet:

(function($) {
    $.hello = 'world';
}(jQuery));

The result of running Slimit on it is:

function($){$.hello='world';}(jQuery);

which is invalid JS. The outer parentheses are required here, so Slimit shouldn't remove them.

The real-world issue that I stumbled upon was with jQuery Timeago plugin: https://github.com/rmm5t/jquery-timeago
It's using the above-mentioned construct and slimit is unable to pack it :-(

@ghost ghost assigned rspivak Apr 6, 2012

@rspivak

This comment has been minimized.

Show comment
Hide comment
@rspivak

rspivak Apr 6, 2012

Owner

Thanks for the bug report. I'll look into this.

Owner

rspivak commented Apr 6, 2012

Thanks for the bug report. I'll look into this.

@rspivak

This comment has been minimized.

Show comment
Hide comment
@rspivak

rspivak Apr 7, 2012

Owner

Fixed in 9408549

I've also uploaded a new version of Slimit 0.6.2 to PyPI. Let me know if you have any other issues and thanks again.

Owner

rspivak commented Apr 7, 2012

Fixed in 9408549

I've also uploaded a new version of Slimit 0.6.2 to PyPI. Let me know if you have any other issues and thanks again.

@rspivak rspivak closed this Apr 7, 2012

@rivol

This comment has been minimized.

Show comment
Hide comment
@rivol

rivol Apr 7, 2012

Wow, thanks a lot for the quick response :-)
I can confirm that 0.6.2 works fine and resolves my issues.

rivol commented Apr 7, 2012

Wow, thanks a lot for the quick response :-)
I can confirm that 0.6.2 works fine and resolves my issues.

acatton added a commit to acatton/fork--rspivak--slimit that referenced this issue Jan 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment