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
[decorators] Support async and generator methods #8742
[decorators] Support async and generator methods #8742
Conversation
nicolo-ribaudo
commented
Sep 20, 2018
Q | A |
---|---|
Fixed Issues? | Fixes #8737 |
Patch: Bug Fix? | 👍 |
Major: Breaking Change? | |
Minor: New Feature? | |
Tests Added + Pass? | Yes |
Documentation PR Link | |
Any Dependency Changes? | |
License | MIT |
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9146/ |
function value(body, params = []) { | ||
return t.objectMethod("method", t.identifier("value"), params, body); | ||
function value(body, params = [], async, generator) { | ||
const method = t.objectMethod("method", t.identifier("value"), params, body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is because we don't require you do to async/generator in t.X
? A weird bug just since we don't pass it down but not sure what we would want to do in general for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.functionDeclaration
accepts async/generator but t.objectMethod
doesn't.
I'd love to have a function to specify the fields I want, like
t.objectMethod.with({
kind: "method",
key: t.identifier("value"),
params, body, async, generator
});