ariya/esprima — pull request #235 by benjamn (2014-03-27 18:11:51+00:00)
Title: Treat yield as a contextual keyword

See the NOTE in [section 11.6.2.1](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-keywords) of the ES6 draft spec. Outside of generator functions (in non-strict mode), `yield` should be treated as an identifier, so there should not necessarily be a syntax error if we find it in that context.

However, note that `yield x` is a syntax error if the `yield` is treated as an identifier, so many misuses of `yield` outside generators are still illegal for that reason.

The spec has some complicated language around whether/when `yield` should be legal in strict mode. To do justice to that part of the spec, Esprima would need to track scope bindings during parsing, which sounds a bit frightening. Until the ES6 spec is finalized, let's stick with the current behavior of simply disallowing `yield` as an identifier in strict mode.

In addition to passing Esprima tests, I can verify that these changes also pass [the Regenerator test suite](https://github.com/facebook/regenerator/blob/master/test/tests.es6.js).

cc @lukehoban @arv @amasad @jeffmo