{"action":"created","issue":{"url":"https://api.github.com/repos/marijnh/acorn/issues/219","labels_url":"https://api.github.com/repos/marijnh/acorn/issues/219/labels{/name}","comments_url":"https://api.github.com/repos/marijnh/acorn/issues/219/comments","events_url":"https://api.github.com/repos/marijnh/acorn/issues/219/events","html_url":"https://github.com/marijnh/acorn/issues/219","id":60774977,"number":219,"title":"Invalid grammar applied to `yield` parsing","user":{"login":"getify","id":150330,"avatar_url":"https://avatars.githubusercontent.com/u/150330?v=3","gravatar_id":"","url":"https://api.github.com/users/getify","html_url":"https://github.com/getify","followers_url":"https://api.github.com/users/getify/followers","following_url":"https://api.github.com/users/getify/following{/other_user}","gists_url":"https://api.github.com/users/getify/gists{/gist_id}","starred_url":"https://api.github.com/users/getify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getify/subscriptions","organizations_url":"https://api.github.com/users/getify/orgs","repos_url":"https://api.github.com/users/getify/repos","events_url":"https://api.github.com/users/getify/events{/privacy}","received_events_url":"https://api.github.com/users/getify/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-03-12T05:52:26Z","updated_at":"2015-03-12T22:28:48Z","closed_at":"2015-03-12T22:10:34Z","body":"The following (inside a well-formed generator of course) is parsed as valid by acorn:\r\n\r\n```js\r\n1 + yield\r\n```\r\n\r\nFor example:\r\n\r\n```js\r\nfunction *foo() {\r\n   var x = 1 + yield;\r\n}\r\n```\r\n\r\nHowever, as [this tweet](https://twitter.com/abargull/status/575625898608582657) from @anba explains, `YieldExpression` is handled incorrectly. `1 + yield` should be invalid. `1 + yield 2` should also be invalid, but `1 + (yield)` and `1 + (yield 2)` should be valid.\r\n\r\nThe `YieldExpression` should be [treated with the same precedence](https://twitter.com/abargull/status/575800817376169986) as the `AssignmentExpression`. As such, `x = 1 + yield` is invalid just like `x = 1 + a = 2` would be, and in both cases, `( )` is required: `x = 1 + (yield)` and `x = 1 + (a = 2)` to make them valid."},"comment":{"url":"https://api.github.com/repos/marijnh/acorn/issues/comments/78658713","html_url":"https://github.com/marijnh/acorn/issues/219#issuecomment-78658713","issue_url":"https://api.github.com/repos/marijnh/acorn/issues/219","id":78658713,"user":{"login":"getify","id":150330,"avatar_url":"https://avatars.githubusercontent.com/u/150330?v=3","gravatar_id":"","url":"https://api.github.com/users/getify","html_url":"https://github.com/getify","followers_url":"https://api.github.com/users/getify/followers","following_url":"https://api.github.com/users/getify/following{/other_user}","gists_url":"https://api.github.com/users/getify/gists{/gist_id}","starred_url":"https://api.github.com/users/getify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getify/subscriptions","organizations_url":"https://api.github.com/users/getify/orgs","repos_url":"https://api.github.com/users/getify/repos","events_url":"https://api.github.com/users/getify/events{/privacy}","received_events_url":"https://api.github.com/users/getify/received_events","type":"User","site_admin":false},"created_at":"2015-03-12T22:28:48Z","updated_at":"2015-03-12T22:28:48Z","body":"Thanks!"}}