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

yield for do expression #10101

Merged
merged 3 commits into from Apr 6, 2021

Conversation

tanhauhau
Copy link
Member

Based on #10072, @nicolo-ribaudo maybe can share a bit more about the edge cases you mentioned in #10072 (comment) ?

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

@JLHwung JLHwung force-pushed the tanhauhau/do-expression-yield branch from 98c0957 to 7ecf6d5 Compare April 6, 2021 01:36
@JLHwung JLHwung changed the base branch from master to main April 6, 2021 01:36
@JLHwung JLHwung added PR: Bug Fix 🐛 A type of pull request used for our changelog categories Spec: Do Expressions labels Apr 6, 2021
@JLHwung
Copy link
Contributor

JLHwung commented Apr 6, 2021

I have rebased this PR on main. I think this PR is ready to ship. It is already a good improvement: The yield expression in doBlock is now supported:

Currently we generate incorrect syntax for valid input

function* iter(x) {
  yield 1;
  var y = do {
    let temp = yield 2;
    temp * temp;
  }
}

@babel-bot
Copy link
Collaborator

babel-bot commented Apr 6, 2021

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/45040/

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 6, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d0cd2cc:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@JLHwung JLHwung changed the title WIP: yield for do expression yield for do expression Apr 6, 2021
@@ -0,0 +1,7 @@
async function* asyncGenerator(x) {
const y = yield* await async function* () {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this await is necessary, since yield in async generators automatically awaits its argument.

@nicolo-ribaudo nicolo-ribaudo merged commit 6b57145 into babel:main Apr 6, 2021
@tanhauhau tanhauhau deleted the tanhauhau/do-expression-yield branch May 5, 2021 01:07
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Aug 4, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2021
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: Do Expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants