-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[[FIX]] Parse
for-in/of
head LHS as asnmt target
Previously, the left-hand side of the `for-in/of` head re-used the code path for `var` declaration lists. This was undesirable for a number of reasons: - it made the `var` statement's parsing logic more complex - it tended to produce inaccurate error messages, e.g. "destructuring binding is available in ES6" - it disallowed syntactically valid code, e.g. `for (a.b in {}) {}` or `for ([x[y]] of []) {}` Refactor the parsing logic of `for-in/of` heads to more faithfully match the actual language grammar. Update the expected errors in the project's unit test suite according to the more accurate messages that this change produces. Simplify `var` statement parsing logic by removing the code intended to support this condition. Maintain support for initializers and the comma operator in order to improve error messages in the case of common programming mistakes.
- Loading branch information
1 parent
b075919
commit da52ad9
Showing
4 changed files
with
114 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.