-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
throw
could be a function
#309
Comments
Yeah, Here's another case: { throw: true }; Can you think of any others? This is same thing is true for all keywords, isn't it? a.should.return(1); |
Ref #200, "Javascript not fully parsed". I don't think this is actually possible to fix in a good way under the current parser model without some weird error-prone hacks :( |
We can fix parts of it, like when a keyword follows a We can then file issues for the remaining scenarios and note them the same as you did above. |
This supports calling libraries which declare properties of objects using reserved words. This does not support declaring these fields. `var a = { 'throw': function() {} }` - works `a.throw()` - works `var a = { throw: function() {} }` - does not work Fixes beautifier#309 Fixes beautifier#351 Fixes beautifier#368 Fixes beautifier#378
Apparently JsBeautifier is making the assumption that
throw
won't be override, but this is clearly not necessarily true. Consider this piece of code from should.js:This will be beautified to:
which, of course, will break the code.
The text was updated successfully, but these errors were encountered: