-
Notifications
You must be signed in to change notification settings - Fork 198
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
Support of es2016's decorators #116
Comments
Fortunately, in this case, I think the only tricky part is the parsing. When you parse a string of code with var ast = recast.parse(source, {
esprima: require("babel-core")
}); Any object with a As of recently, In general, I am totally happy to add experimental syntax to the pretty printer, even when it conflicts with existing syntax. For example, the The // Note: recast.visit is the same as require("ast-types").visit.
recast.visit(ast, {
visitDecorator: function(path) {
var node = path.node;
// ...
this.traverse(path);
}
}); So in this case, there might not be too much work for you to do (sorry? haha), though I would be very happy to hear about any problems you encounter, since these features are still pretty new/untested. |
I originally wrote that reply thinking it was a |
Oh, ok, thanks a lot! I thought that ast-type didn't support decorators, since I couldn't find the definition in the es7.js file. using the |
Any estimation about when do you plan to publish the last versions of recast and ast-types to NPM? Because I was trying to figure why it didn't work for me, it's just because the version I had (from npm) didn't work, getting the sources from github worked fine :) |
Though I just published a small update (0.8.2), I wonder if you're still depending on ~0.7? The 0.7 to 0.8 minor version bump was pretty recent, in case you missed it. |
When did you publish the update? Because I was conviced it was still on ~0.7 (as displayed both by |
I tried using recast on a file containing es2016 decorators. Of course, it failed (unexpected token illegal), since, based on what I understood, this syntax is not an ast type (I had the same problem with the es2016 bind syntax). Considering that the async function type exist, I guess that it could be possible to add the support to decorators (both are es2016 proposals).
I'm willing to work on this issue, however, I struggle to see what would be the correct way to start. I would actually be fine to add a partial support to this feature, considering that what I need, is to be able to parse a file without breaking, not to add any decorator. Do you have any tip you could share with me?
The text was updated successfully, but these errors were encountered: