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

asyncFunctions transformation does not work with generators: 'parse' #1231

Closed
UltCombo opened this issue Aug 3, 2014 · 4 comments · Fixed by #1235
Closed

asyncFunctions transformation does not work with generators: 'parse' #1231

UltCombo opened this issue Aug 3, 2014 · 4 comments · Fixed by #1235
Assignees
Labels

Comments

@UltCombo
Copy link
Contributor

UltCombo commented Aug 3, 2014

The asyncFunctions transformation does not work unless the generators transformation is applied.

Test case:

traceur.compile('async function f() { await p(); }', {
    generators: 'parse',
    asyncFunctions: true
});
'"use strict";\nasync function f() {\n  await p();\n}\n'

It would be nice to allow asyncFunctions to use vanilla ES6 generators when generators: 'parse', for usage in Node 0.11.13.

@UltCombo
Copy link
Contributor Author

UltCombo commented Aug 3, 2014

My initial idea was to transform async functions into a native generator wrapped in traceur.asyncWrap and then apply the generators transform, but that doesn't seem viable now as asyncWrap uses some internals from the generators transformation as well it seems.

At least, the asyncFunctions transform should be applied independent of the generators option.

@arv
Copy link
Collaborator

arv commented Aug 4, 2014

The async function transformer does not transform async functions into generators. We would need to write a new transformer to support that.

@UltCombo
Copy link
Contributor Author

UltCombo commented Aug 4, 2014

@arv Oh ok, never mind that bit for now. Can we get asyncFunctions: true to work with generators: false?

I don't quite see the reason why the async functions transformer stops working when generators are set to false/parse.

@arv
Copy link
Collaborator

arv commented Aug 4, 2014

Yes. async-functions should work with generators false. That is clearly a bug.

@arv arv self-assigned this Aug 4, 2014
@arv arv added the bug label Aug 4, 2014
arv added a commit to arv/traceur-compiler that referenced this issue Aug 4, 2014
arv added a commit to arv/traceur-compiler that referenced this issue Aug 4, 2014
@arv arv closed this as completed in #1235 Aug 4, 2014
arv added a commit to arv/traceur-compiler that referenced this issue Apr 4, 2016
This is done by setting `--async-functions=generator --generators=parse`.

If you pass --output-language=es6 then we know transform async
functions to generators.

Related to google#1231
Fixes google#1780
arv added a commit to arv/traceur-compiler that referenced this issue Apr 4, 2016
This is done by setting `--async-functions=generator --generators=parse`.

Related to google#1231
Fixes google#1780
arv added a commit to arv/traceur-compiler that referenced this issue Apr 4, 2016
This is done by setting `--async-functions=generator --generators=parse`.

Related to google#1231
Fixes google#1780
arv added a commit to arv/traceur-compiler that referenced this issue Apr 4, 2016
This is done by setting `--async-functions=generator --generators=parse`.

Related to google#1231
Fixes google#1780
arv added a commit to arv/traceur-compiler that referenced this issue Apr 4, 2016
This is done by setting `--async-functions=generator --generators=parse`.

Related to google#1231
Fixes google#1780
arv added a commit to arv/traceur-compiler that referenced this issue Apr 7, 2016
This is done by setting `--async-functions --generators=parse`.

Related to google#1231
Fixes google#1780
arv added a commit that referenced this issue Apr 7, 2016
This is done by setting `--async-functions --generators=parse`.



Related to #1231

Fixes #1780
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants