-
Notifications
You must be signed in to change notification settings - Fork 882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make sure that exports \{default\} throws an error #330
Conversation
Are you sure that such check would be enough? (compared to https://github.com/marijnh/acorn/blob/master/src/expression.js#L642-L644) |
Based on the tests I added, I think so. |
|
Yeah, that's for the form:
I haven't addressed that form in this PR as the bug was about non-default exports. Do you want me to look at that too? |
No, that line with |
Ah, I see. Still, I'm having trouble coming up with a test case that behaves incorrectly with this code. Do you have one in mind? |
In fact you're right, there shouldn't be as |
No worries, I'd rather have you being over careful. :) |
@@ -526,6 +526,13 @@ pp.parseExport = function(node) { | |||
if (this.eatContextual("from")) { | |||
node.source = this.type === tt.string ? this.parseExprAtom() : this.unexpected() | |||
} else { | |||
// check for keywords used as local names | |||
for (let i=0; i<node.specifiers.length; i++) { |
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.
@nzakas Can you please put some space around operators? Thanks.
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.
Done!
Any other changes needed here? @marijnh |
Nope, looks great. But this airport wifi won't allow me to push to github, and this branch isn't based on the current master, so I don't want to use github's magic merge button which I expect will introduce needless merge commits. I'll merge this when I get home later today. |
Merged as 37efe0b! |
Thanks! |
This checks if the local name of an export specifier is a keyword or reserved word only when there's no
from
clause (the case with afrom
clause appears to already work, though I'm not sure why).Fixes #326