Skip to content
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

'yield' is a reserved word in strict mode #157

Closed
jamietre opened this issue Jun 17, 2013 · 8 comments
Closed

'yield' is a reserved word in strict mode #157

jamietre opened this issue Jun 17, 2013 · 8 comments
Assignees
Milestone

Comments

@jamietre
Copy link

See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Reserved_Words

The immediate consequence of this to me is that the minifier used by ASP.NET MVC4's script optimizer fails. Consider replacing the method name with a non-reserved word.

@briancavalier
Copy link
Member

Hey @jamietre, reserved words may legally be used as object property names in ES5, so we probably won't change the name yield. However, perhaps what we should do is to quote it when using it internally in when.js so that tools such as .NET's, that don't yet understand ES5 rules, don't break.

How does that sound?

@jamietre
Copy link
Author

Sounds great! Thanks.

@briancavalier
Copy link
Member

Cool, just to make sure: Your tools will handle: promise['yield'](x), and they won't handle promise.yield(x)?

I did a quick check of the codebase and there are only 2 usages of .yield(x): one in when.js and one in when/unfold/list.js. So, we should be able to change those both to ['yield'](x) in a 2.1.1 hotfix.

@jamietre
Copy link
Author

Yes - I had already made the change locally it works fine with exactly that change.

@briancavalier
Copy link
Member

Thanks! I'll try to get that out within the next day.

briancavalier added a commit that referenced this issue Jun 17, 2013
…th .NET minifier, which does not yet understand ES5 identifier-as-property rules
@briancavalier
Copy link
Member

Just pushed a fix to the hotfix-157 branch. Let me know if that looks good to you.

@jamietre
Copy link
Author

Perfect! Thank you so much!

@briancavalier
Copy link
Member

Pushed to master, tagged, and published.

@ghost ghost assigned briancavalier Jun 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants