Open Bug 1044459 Opened 8 years ago Updated 7 years ago

Reflect.parse: Support default and named bindings in one ImportDeclaration

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

People

(Reporter: me, Unassigned)

References

(Blocks 1 open bug)

Details

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0 (Beta/Release)
Build ID: 20140721004001

Steps to reproduce:

As per http://people.mozilla.org/~jorendorff/es6-draft.html#sec-imports, ImportClause may consist of ImportBinding and NamedImports separated by comma.

You can see example at http://jsmodules.io/:
> For the curious, you can import both the default export and a number of named exports in the same import:
> `import asap, { later } from "asap";`


Actual results:

Currently, this is not supported by Reflect.parse nor Esprima.


Expected results:

In Acorn, I used additional `ImportSpecifier.default` boolean property that allows to recognize default binding from named ones.
Idea was taken from earlier version of Esprima that is used in https://github.com/square/es6-module-transpiler that has `ExportDeclaration.default` boolean property, but better proposals are welcome.
OS: Windows 8.1 → All
Hardware: x86_64 → All
Summary: Reflect.parse: support default and named bindings in one ImportDeclaration → Reflect.parse: Support default and named bindings in one ImportDeclaration
Blocks: es6
Status: UNCONFIRMED → NEW
Ever confirmed: true
I would like to get some input on this proposed spec [1]. I did mention it in the related Acorn bug [2] as well, and I was looking for input.

[1]: https://github.com/impinball/es6-module-ast-proposal/tree/master
[2]: https://github.com/marijnh/acorn/issues/157
Blocks: 1173387
No longer blocks: es6
You need to log in before you can comment on or make changes to this bug.