Skip to content

problem with minified version of ember #733

maffoo opened this Issue Apr 24, 2012 · 6 comments

3 participants

maffoo commented Apr 24, 2012

Ember's jison-generated parser contains the function:

performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {

which minifies to:

performAction:function d(a,b,c,d,e,f,g){

where the function name 'd' matches the name of the fourth parameter. This seems to work in most cases (e.g. browsers) but when I try to precompile ember templates on the server using rhino I get errors because the variable name 'd' resolves to the function itself, rather than the argument. It would seem that this minification is incorrect, because a collision between the function and argument name is probably undesired.

Ember.js member
wagenet commented Apr 24, 2012

@maffoo This is either a bug in uglifyjs, which we use for minification, or in Rhino.

maffoo commented Apr 25, 2012

@wagenet I tried piping ember- through uglifyjs here:

The offending parser function comes out as


with the function name removed entirely, as I would expect. So I think there still might be an issue with the way the minified ember file is being produced. It may also be the case that rhino has a bug with handling functions whose argument names collide with the function name, but it would still appear there's a problem with the minification.

eishay commented Apr 25, 2012

To be specific is this line:

@wagenet doesn't it need to be:

performAction: function performAction(yytext,yyleng,yylineno,yy,yystate,$$,_$) ...


performAction: function(yytext,yyleng,yylineno,yy,yystate,$$,_$) ...

I don't understand the syntax:

methodName: function anonymous(){}

What does it mean?

Ember.js member
wagenet commented Apr 25, 2012

@eishay That line is generated by jison. It's not something we have direct control over.

@wagenet wagenet closed this in e018447 Apr 25, 2012
Ember.js member
wagenet commented Apr 25, 2012

Looks like it was a uglifier bug that's been fixed in newer versions.

maffoo commented Apr 25, 2012

great! thanks for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.