-
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
Module edge cases that are missed #326
Comments
We're still turning off reserved word checking by default (see the I can't get Acorn to accept |
Attached patch fixes the |
Ah, looks like I wasn't using the latest version. Sorry about that. After upgrading, I found two more issues: export {default} This should be a syntax error (it needs |
I'm pretty sure the standard allows this (and that it means to export from the local module). See http://www.ecma-international.org/ecma-262/6.0/#sec-exports |
(Also, you mention 'two more issues' and only list one. Did you forget to add the second?) |
Oops, copy-paste error, I meant one more issue. It's possible I'm misunderstanding the spec, but the Espree module implementation was written by @caridy, so I'd defer to his knowledge in this area. |
The names in
There is a special syntax definition that prohibit the use of FutureReservedWord. |
@rwaldron So |
@nzakas this is tricky because the spec doesn't provide all the details, it is just a combination of rules, but in principle, |
To expand upon @caridy's comment and to correct a minor mistake in @rwaldron's comment:
Note that the last Early Error link only applies to the following construct:
not
So export { default } from "algo" is supported. |
Yep. Incidentally, I had meant to type (or thought I did) "ReservedWord and strict mode FutureReservedWord"... I must've deleted that part when I was making it a link. Thanks for spotting that and providing a correction. |
Thanks everyone. @marijnh I'll put together a PR. |
It looks like |
There are a couple of cases I've come across where the parser should throw errors but does not.
The first:
In ES6,
await
is a future reserved word when in a module (reference) and should throw an error.The second:
This should throw an error because exporting
*
requiresfrom
and a module name, such as:The text was updated successfully, but these errors were encountered: