Skip to content
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

Merged

Conversation

nicolo-ribaudo
Copy link
Member

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

@nicolo-ribaudo nicolo-ribaudo added PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Decorators labels Sep 20, 2018
@babel-bot
Copy link
Collaborator

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);
Copy link
Member

@hzoo hzoo Sep 24, 2018

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

Copy link
Member Author

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
});

@nicolo-ribaudo nicolo-ribaudo merged commit af694eb into babel:master Sep 25, 2018
@nicolo-ribaudo nicolo-ribaudo deleted the decorators-async-methods branch September 25, 2018 08:03
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Decorators
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Async keyword removed when decorator is applied to class
4 participants