Skip to content

yield for do expression#10101

Merged
nicolo-ribaudo merged 3 commits intobabel:mainfrom
tanhauhau:tanhauhau/do-expression-yield
Apr 6, 2021
Merged

yield for do expression#10101
nicolo-ribaudo merged 3 commits intobabel:mainfrom
tanhauhau:tanhauhau/do-expression-yield

Conversation

@tanhauhau
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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 requested a review from nicolo-ribaudo April 6, 2021 01:41
@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
Copy Markdown
Member

@nicolo-ribaudo nicolo-ribaudo Apr 6, 2021

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.

4 participants