archives

« Bugzilla Issues Index

#2410 — export { yield } should not be allowed


Created attachment 69
highlighted productions in spec

The ES6 draft seems to allow

export { yield }

and

export { yield as Identifier }

I assume this is an error in the text.

Highlighted resolution path for the ExportDeclaration production is attached.


Wait, is `export { yield }` actually allowed and it just exports the variable named "yield" as a named export?

If so, please close this bug. Sorry for the fuss.

Is there an annotated version of the spec somewhere yet, which would explain these kinds of things?


Module code is always strict code (see 10.2.1 Strict Mode Code), so the additional early error restriction in 12.1.2.1 applies which explicitly disallows "yield" as an IdentifierReference in strict code:
---
12.1.2.1 Static Semantics: Early Errors

NonResolvedIdentifier : yield
- It is a Syntax Error if the IdentifierReference is contained in strict code.
---