google-code-export / esprima

Automatically exported from code.google.com/p/esprima
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

ES6 module syntax update #597

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Since we are approaching the sign-off of ES6 specs, and the import and export 
syntax is now settled (finally), it is time to update the harmony branch to 
align with the specs.

This unfortunately is a non-backward compatible change for users of the harmony 
branch if they are using either `module {}` syntax or any other now-invalid 
syntax, but since this branch is a living creature, that should be just fine. 

These are the changes we are proposing:

* revision of ES6 import final syntax based on specs
* revision of ES6 export final syntax based on specs
* introduces Syntax.ImportGlobSpecifier for import * as foo from "foo"
* introduces Syntax.ImportDefaultSpecifier for import foo from "foo";
* removes kind=default and kind=named from ImportDeclaration in favor of 
Syntax.ImportDefaultSpecifier form
* removes default=true from ExportDeclaration
* removes module {} syntax

The main reason for removing `kind` is because you can now mix default import 
with glob import and named import in the same import declaration, e.g.: `import 
foo, * as bar, {baz} from "mod"`, this means we need to differentiate each 
import specifier rather than the import declaration.

The main reason for removing `default` is because you can now have 
`FunctionExpression` or `ClassExpression` to distinguish this, e.g.: `export 
default function () {}` vs `export default function foo () {}`.

Original issue reported on code.google.com by car...@gmail.com on 28 Sep 2014 at 8:18

GoogleCodeExporter commented 9 years ago
ES6 Module Syntax Sign-Off
https://github.com/ariya/esprima/commit/0137f568ff

Add few more tests to achieve module syntax full code coverage.
https://github.com/ariya/esprima/commit/d17e30fde0

Ensure that harmony module tests are also included in the web tests.
https://github.com/ariya/esprima/commit/8d629123ac

Original comment by ariya.hi...@gmail.com on 10 Jan 2015 at 9:06