ariya/esprima — pull request #77 by voloko (2012-06-13 07:12:04+00:00)
Title: ES6: "module" keyword conflict

module was not (and is still not) a keyword. Making it a keyword conflicts with existing code, particularly with CommonJS module variable. Consider an expression

module.exports = Foo;

This was (and AFIU still is) a valid expression. Parser should be able to discern between an expression using module as an Identifier and a module declaration that uses module as a Keyword.

This diff makes the parser more intelligent, though somewhat less effective when parsing expression with module.
"module identifier ..." is considered a module declaration, while everything else is considered as a statement

Updated tests. Removed a newline check, since

module
x = y

is a perfectly valid piece of code: variable module followed by an assignment.

http://code.google.com/p/esprima/issues/detail?id=280