Open idibidiart opened 8 years ago
Not yet.
I've been targeting ES5 only so far, because the estree spec and related tooling are still catching up with ES6 (e.g. estools/esvalid#7). So if it existed, it would have to be behind an --experimental
flag.
However, it should be quite possible to add even now: All the built-in macros just emit estree objects that are compiled by escodegen. There is an experimental estree spec for async/await and escodegen seems to support it!
I'll try it sometime soonish—PR welcome too.
It looks like as of version 6.0, Babel is no longer ESTree compliant. I opened an issue over there but the author said he's not willing to support the standard format anymore.
Perhaps we should altogether move to target Babel's AST spec?
Pros:
Cons:
That's a possible solution. Another solution is to write a compatibility layer that takes a estree ast as input and outputs a babel ast.
@lhorie not sure if you saw my comment in the issue (maybe missed it since it was right before yours) but basically I'l be doing a compatibility layer
Ooh nice. That's awesome to hear. I totally did miss your comment. @hzoo
@lhorie https://github.com/babel/acorn-to-esprima/pull/3 - I'l need to add a lot more tests since I know some of the loc/range info is wrong now.
Update: escodegen fully supports ES6 AFAICT, and I've already started some of this process in #41.
@11111000000
I'd bet on an eventual solution coming through #24.
For now, if you're desperate, with #34 merged you can write macros that return ES6 estree objects. If you like, you could try returning such an object from your own macros, like this.
@anko: thanks, watch closely
May I also point out that the isExpression
, etc. are part of Babel, anyways (and they've been that way since at least 5)? I'm not a huge fan of Babel, but I just thought I'd point that out.
Is it possible to use ES6/7 features like async/await ? Can you show a working example?