-
-
Notifications
You must be signed in to change notification settings - Fork 254
Throw error for reserved words enum and await #195
Conversation
Current coverage is 96.21% (diff: 100%)
|
b6892dc to
0884f97
Compare
|
Looks like I might also need to write some more tests to get higher coverage |
|
I think we should make the And maybe consolidate the error messages so it's the basically the same thing - not being able to use reserved words and in strict mode or not |
0884f97 to
cff5f4b
Compare
|
@hzoo How do these changes look? I removed the check and tests for renamed destructuring assignments and centralized the reserved word checking logic. Wanted to double check before fixing all the tests (129 failing tests now because the error message has changed to the more generic one) :) I definitely think this will be easier to maintain 👍 |
src/parser/expression.js
Outdated
|
|
||
| if (!prop.computed && prop.key.type === "Identifier") { | ||
| if (isPattern) { | ||
| if (this.isKeyword(prop.key.name)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved this into the checkReservedWord() method to put all the reserved word checks in there
|
Updated! Let me know if there's anything else that needs to be done. Will follow this PR up with another one that uses the |
|
@danez @motiz88 Thoughts on this approach? Let me know if there's anything else I can do to land this. As a follow up I'd like to check renamed destructuring assignments for reserved words (currently not checked) as well as look into the other half of this issue (allowing |
Refs #134
Removed check and tests for renamed destructuring assignments. See comments below.
This PR ended up being a bit bigger because Babylon currently doesn't check renamed destructured values to see if the new name is a reserved word/keyword. So before this PR, the following would not warn:To ensure the reserved words error is thrown everywhere, I also implemented this check. Is this too many changes in one PR?