Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.7k
fix: do expressions should allow early exit#17137
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
babel-bot commentedFeb 16, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Build successful! You can test your changes in the REPL here:https://babeljs.io/repl/build/59090 |
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.
Thank you for PR. This is a complete rewrite of the do transform. It would be great if you can provide an abstract in the PR description so that it would be easier for reviewers to jump in.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
...do-expressions/test/fixtures/do-expression-switch-case/condition-before-expression/output.js OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
...proposal-do-expressions/test/fixtures/do-expression-with-early-exit/call-expression/input.js OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
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.
This PR now looks good to me, thank you for working on this topic. If you would like to contribute more, it would be great to port the do expressions overwrite to the async-do-expressions plugin.
@@ -29,6 +29,8 @@ type CompletionContext = { | |||
// when a `break` statement is an immediate descendant of a block statement, e.g. | |||
// `{ break }`, it can influence the control flow in the upper levels. | |||
shouldPopulateBreak: boolean; | |||
// Whether the `break` statement should be preserved. | |||
shouldPreserveBreak: boolean; |
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.
Aside: I think this option should be the default or even materialized in Babel 8: such thatgetCompletionRecord
never mutate AST, for those legacy IIFE usage, they should manually replace all BreakStatement toreturn void 0
.
if (needResult) { | ||
const completions = path | ||
.get("body") | ||
.getCompletionRecords(/* shouldPreserveBreak */ true) |
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.
SinceshouldPreserveBreak
is a new feature from@babel/traverse
, it is possible that users are depending on an older@babel/core
which does not have this feature.
@liuxingbaoyu@nicolo-ribaudo Sincedo-expressions
is a still an early stage proposal, wdyt we bump the required API version to ^7.27?
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.
What happens when using this with older@babel/traverse
versions? Does it just follow the old behavior?
I have not read the code yet so it's possible you are already doing this, but if we are not going to implement these we should make sure to throw an explicit error saying "This is not supported by Babel" |
kermanx commentedApr 5, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I updated the code to support do-expression within function parameters, variable declaration, assignment expression, logical expression and all kinds of loops. Also it now uses |
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.
Thanks for the PR! This is incredible. And sorry it took so long to review it.
I haven't reviewed the tests yet, but I have some comments about the implementation.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
return void 0; | ||
} | ||
const x = n => { | ||
{ |
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.
Do you think it would be difficult to avoid this extra unnecessary block? Maybe by just using a list of statements rather than a block containing a list of statements.
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.
But the problem is that I can't find a simple way to detect if some new variables are declared in the scope of do-expression 🥹
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.
Let's keep this as is then :)
It can be improved in the future.
Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>
Co-authored-by: Nicolò Ribaudo <hello@nicr.dev>
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.
This is very good, thank you!
62af1a6
intobabel:mainUh oh!
There was an error while loading.Please reload this page.
![snyk-io[bot]](https://badgen.net/badge/icon/snyk-io%5Bbot%5D/green?label=)[<img width="16" alt="Powered by Pull Request Badge"src="https://user-images.githubusercontent.com/1393946/111216524-d2bb8e00-85d4-11eb-821b-ed4c00989c02.png">](https://pullrequestbadge.com/?utm_medium=github&utm_source=reisene&utm_campaign=badge_info)<!--PR-BADGE: PLEASE DO NOT REMOVE THIS COMMENT --><h3>Snyk has created this PR to upgrade @babel/core from 7.26.7 to7.27.1.</h3>:information_source: Keep your dependencies up-to-date. This makes iteasier to fix existing vulnerabilities and to more quickly identify andfix newly disclosed vulnerabilities when they affect your project.<hr/>- The recommended version is **4 versions** ahead of your currentversion.- The recommended version was released **a month ago**.<details><summary><b>Release notes</b></summary><br/> <details> <summary>Package name: <b>@babel/core</b></summary> <ul> <li><b>7.27.1</b> - <ahref="https://redirect.github.com/babel/babel/releases/tag/v7.27.1">2025-04-30</a></br><h2>v7.27.1(2025-04-30)</h2><p>Thanks <a data-hovercard-type="user"data-hovercard-url="/users/kermanx/hovercard"data-octo-click="hovercard-link-click"data-octo-dimensions="link_type:self"href="https://redirect.github.com/kermanx">@ kermanx</a> and <aclass="user-mention notranslate" data-hovercard-type="user"data-hovercard-url="/users/woaitsAryan/hovercard"data-octo-click="hovercard-link-click"data-octo-dimensions="link_type:self"href="https://redirect.github.com/woaitsAryan">@ woaitsAryan</a> foryour first PRs!</p><h4>👓 Spec Compliance</h4><ul><li><code>babel-parser</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17254"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17254/hovercard">#17254</a> Allow<code>using of</code> as lexical declaration within for (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li><li><a href="https://redirect.github.com/babel/babel/pull/17230"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17230/hovercard">#17230</a>Disallow get/set in TSPropertySignature (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li><li><code>babel-parser</code>, <code>babel-types</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17193"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17193/hovercard">#17193</a>Stricter TSImportType options parsing (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li></ul><h4>🐛 Bug Fix</h4><ul><li><code>babel-plugin-proposal-destructuring-private</code>,<code>babel-plugin-proposal-do-expressions</code>,<code>babel-traverse</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17137"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17137/hovercard">#17137</a> fix:do expressions should allow early exit (<ahref="https://redirect.github.com/kermanx">@ kermanx</a>)</li></ul></li><li><code>babel-helper-wrap-function</code>,<code>babel-plugin-transform-async-to-generator</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17251"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17251/hovercard">#17251</a> Fix:propagate argument evaluation errors through async promise chain (<ahref="https://redirect.github.com/magic-akari">@ magic-akari</a>)</li></ul></li><li><code>babel-helper-remap-async-to-generator</code>,<code>babel-plugin-transform-async-to-generator</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17231"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17231/hovercard">#17231</a> fixapply()/call() annotated as pure (<ahref="https://redirect.github.com/Lacsw">@ Lacsw</a>)</li></ul></li><li><code>babel-helper-fixtures</code>, <code>babel-parser</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17233"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17233/hovercard">#17233</a> CreateChainExpression within TSInstantiationExpression (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li><li><code>babel-generator</code>, <code>babel-parser</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17226"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17226/hovercard">#17226</a> Filloptional AST properties when both estree and typescript parser pluginare enabled (Part 2) (<a href="https://redirect.github.com/JLHwung">@JLHwung</a>)</li></ul></li><li><code>babel-parser</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17224"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17224/hovercard">#17224</a> Filloptional AST properties when both estree and typescript parser pluginare enabled (Part 1) (<a href="https://redirect.github.com/JLHwung">@JLHwung</a>)</li><li><a href="https://redirect.github.com/babel/babel/pull/17080"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17080/hovercard">#17080</a> Fixstart of TSParameterProperty (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li><li><code>babel-compat-data</code>, <code>babel-preset-env</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17228"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17228/hovercard">#17228</a> Updatefirefox bugfix compat data (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li><li><code>babel-traverse</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17156"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17156/hovercard">#17156</a> fix:Objects and arrays with multiple references should not be evaluated (<ahref="https://redirect.github.com/liuxingbaoyu">@ liuxingbaoyu</a>)</li></ul></li><li><code>babel-generator</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17216"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17216/hovercard">#17216</a> Fix:support const type parameter in generator (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li></ul><h4>💅 Polish</h4><ul><li><code>babel-plugin-bugfix-v8-spread-parameters-in-optional-chaining</code>,<code>babel-plugin-proposal-decorators</code>,<code>babel-plugin-transform-arrow-functions</code>,<code>babel-plugin-transform-class-properties</code>,<code>babel-plugin-transform-destructuring</code>,<code>babel-plugin-transform-object-rest-spread</code>,<code>babel-plugin-transform-optional-chaining</code>,<code>babel-plugin-transform-parameters</code>,<code>babel-traverse</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17221"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17221/hovercard">#17221</a> Reducegenerated names size for the 10th-11th (<ahref="https://redirect.github.com/nicolo-ribaudo">@nicolo-ribaudo</a>)</li></ul></li></ul><h4>🏠 Internal</h4><ul><li><code>babel-runtime-corejs2</code>,<code>babel-runtime-corejs3</code>, <code>babel-runtime</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17263"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17263/hovercard">#17263</a> Removeunused <code>regenerator-runtime</code> dep in <code>@babel/runtime</code> (<ahref="https://redirect.github.com/nicolo-ribaudo">@nicolo-ribaudo</a>)</li></ul></li><li><code>babel-compat-data</code>, <code>babel-preset-env</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17256"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17256/hovercard">#17256</a> Tuneplugin compat data (<a href="https://redirect.github.com/JLHwung">@JLHwung</a>)</li></ul></li><li><code>babel-compat-data</code>, <code>babel-standalone</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17236"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17236/hovercard">#17236</a>migrate babel-compat-data build script to mjs (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li><li><code>babel-register</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/16844"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/16844/hovercard">#16844</a>Migrate <code>@ babel/register</code> to cts (<ahref="https://redirect.github.com/liuxingbaoyu">@ liuxingbaoyu</a>)</li></ul></li><li><code>babel-helpers</code>,<code>babel-plugin-transform-async-generator-functions</code>,<code>babel-plugin-transform-regenerator</code>,<code>babel-preset-env</code>, <code>babel-runtime-corejs3</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17205"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17205/hovercard">#17205</a> Inlineregenerator in the relevant packages (<ahref="https://redirect.github.com/nicolo-ribaudo">@nicolo-ribaudo</a>)</li></ul></li><li><em>All packages</em><ul><li><a href="https://redirect.github.com/babel/babel/pull/17207"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17207/hovercard">#17207</a>Enforce node protocol import (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li></ul><h4>🔬 Output optimization</h4><ul><li><code>babel-helpers</code>,<code>babel-plugin-transform-modules-commonjs</code>,<code>babel-runtime-corejs3</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/16538"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/16538/hovercard">#16538</a> Reduce<code>interopRequireWildcard</code> size (<ahref="https://redirect.github.com/liuxingbaoyu">@ liuxingbaoyu</a>)</li></ul></li><li><code>babel-helpers</code>,<code>babel-plugin-transform-async-generator-functions</code>,<code>babel-plugin-transform-regenerator</code>,<code>babel-preset-env</code>, <code>babel-runtime-corejs3</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17213"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17213/hovercard">#17213</a> Reduce<code>regeneratorRuntime</code> size (<ahref="https://redirect.github.com/liuxingbaoyu">@ liuxingbaoyu</a>)</li></ul></li></ul><h4>Committers: 9</h4><ul><li>Aryan Bharti (<a href="https://redirect.github.com/woaitsAryan">@woaitsAryan</a>)</li><li>Babel Bot (<a href="https://redirect.github.com/babel-bot">@babel-bot</a>)</li><li>Frolov Roman (<a href="https://redirect.github.com/Lacsw">@Lacsw</a>)</li><li>Huáng Jùnliàng (<a href="https://redirect.github.com/JLHwung">@JLHwung</a>)</li><li>Nicolò Ribaudo (<ahref="https://redirect.github.com/nicolo-ribaudo">@nicolo-ribaudo</a>)</li><li><a href="https://redirect.github.com/liuxingbaoyu">@liuxingbaoyu</a></li><li><a href="https://redirect.github.com/magic-akari">@magic-akari</a></li><li>_Kerman (<a href="https://redirect.github.com/kermanx">@kermanx</a>)</li><li>fisker Cheung (<a href="https://redirect.github.com/fisker">@fisker</a>)</li></ul> </li> <li><b>7.26.10</b> - <ahref="https://redirect.github.com/babel/babel/releases/tag/v7.26.10">2025-03-11</a></br><h2>v7.26.10(2025-03-11)</h2><p>Thanks <a data-hovercard-type="user"data-hovercard-url="/users/jordan-choi/hovercard"data-octo-click="hovercard-link-click"data-octo-dimensions="link_type:self"href="https://redirect.github.com/jordan-choi">@ jordan-choi</a> and <aclass="user-mention notranslate" data-hovercard-type="user"data-hovercard-url="/users/mmmsssttt404/hovercard"data-octo-click="hovercard-link-click"data-octo-dimensions="link_type:self"href="https://redirect.github.com/mmmsssttt404">@ mmmsssttt404</a> foryour first PRs!</p><p>This release includes a fix for <a title="GHSA-968p-4wvh-cqc8"href="https://redirect.github.com/babel/babel/security/advisories/GHSA-968p-4wvh-cqc8">GHSA-968p-4wvh-cqc8</a>,a security vulnerability which affects the <code>.replace</code> methodof transpiled regular expressions that use named capturing groups.</p><h4>👓 Spec Compliance</h4><ul><li><code>babel-parser</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17159"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17159/hovercard">#17159</a>Disallow decorator in array pattern (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li></ul><h4>🐛 Bug Fix</h4><ul><li><code>babel-parser</code>, <code>babel-template</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17164"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17164/hovercard">#17164</a> Fix:always initialize ExportDeclaration attributes (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li><li><code>babel-core</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17142"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17142/hovercard">#17142</a> fix:"Map maximum size exceeded" in deepClone (<ahref="https://redirect.github.com/liuxingbaoyu">@ liuxingbaoyu</a>)</li></ul></li><li><code>babel-parser</code>,<code>babel-plugin-transform-typescript</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17154"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17154/hovercard">#17154</a> Updatetypescript parser tests (<a href="https://redirect.github.com/JLHwung">@JLHwung</a>)</li></ul></li><li><code>babel-traverse</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17151"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17151/hovercard">#17151</a> fix:Should not evaluate vars in child scope (<ahref="https://redirect.github.com/liuxingbaoyu">@ liuxingbaoyu</a>)</li></ul></li><li><code>babel-generator</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17153"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17153/hovercard">#17153</a> fix:Correctly generate <code>abstract override</code> (<ahref="https://redirect.github.com/liuxingbaoyu">@ liuxingbaoyu</a>)</li></ul></li><li><code>babel-parser</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17107"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17107/hovercard">#17107</a> Fixsource type detection when parsing TypeScript (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li><li><code>babel-helpers</code>, <code>babel-runtime</code>,<code>babel-runtime-corejs2</code>, <code>babel-runtime-corejs3</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17173"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17173/hovercard">#17173</a> Fixprocessing of replacement pattern with named capture groups (<ahref="https://redirect.github.com/%5Bmmmsssttt404%5D(https://redirect.github.com/mmmsssttt404)">@mmmsssttt404</a>)</li></ul></li></ul><h4>💅 Polish</h4><ul><li><code>babel-standalone</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17158"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17158/hovercard">#17158</a> Avoidwarnings when re-bundling @ babel/standalone with webpack (<ahref="https://redirect.github.com/liuxingbaoyu">@ liuxingbaoyu</a>)</li></ul></li></ul><h4>🏠 Internal</h4><ul><li><code>babel-parser</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17160"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17160/hovercard">#17160</a>Left-value parsing cleanup (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li></ul><h4>Committers: 6</h4><ul><li>Babel Bot (<a href="https://redirect.github.com/babel-bot">@babel-bot</a>)</li><li>Huáng Jùnliàng (<a href="https://redirect.github.com/JLHwung">@JLHwung</a>)</li><li>Nicolò Ribaudo (<ahref="https://redirect.github.com/nicolo-ribaudo">@nicolo-ribaudo</a>)</li><li>Yunyoung Jordan Choi (<ahref="https://redirect.github.com/jordan-choi">@ jordan-choi</a>)</li><li><a href="https://redirect.github.com/liuxingbaoyu">@liuxingbaoyu</a></li><li><a href="https://redirect.github.com/mmmsssttt404">@mmmsssttt404</a></li></ul> </li> <li><b>7.26.9</b> - <ahref="https://redirect.github.com/babel/babel/releases/tag/v7.26.9">2025-02-14</a></br><h2>v7.26.9(2025-02-14)</h2><h4>🐛 Bug Fix</h4><ul><li><code>babel-types</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17103"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17103/hovercard">#17103</a> fix:Definition for <code>TSPropertySignature.kind</code> (<ahref="https://redirect.github.com/liuxingbaoyu">@ liuxingbaoyu</a>)</li></ul></li><li><code>babel-generator</code>, <code>babel-types</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17062"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17062/hovercard">#17062</a> PrintTypeScript optional/definite in ClassPrivateProperty (<ahref="https://redirect.github.com/jamiebuilds-signal">@jamiebuilds-signal</a>)</li></ul></li></ul><h4>🏠 Internal</h4><ul><li><code>babel-types</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17130"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17130/hovercard">#17130</a> Use<code>.ts</code> files with explicit reexports to solve name conflicts(<a href="https://redirect.github.com/nicolo-ribaudo">@nicolo-ribaudo</a>)</li></ul></li><li><code>babel-core</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17127"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17127/hovercard">#17127</a> Do notdepend on <code>@ types/gensync</code> in Babel 7 (<ahref="https://redirect.github.com/nicolo-ribaudo">@nicolo-ribaudo</a>)</li></ul></li></ul><h4>Committers: 5</h4><ul><li>Babel Bot (<a href="https://redirect.github.com/babel-bot">@babel-bot</a>)</li><li>Huáng Jùnliàng (<a href="https://redirect.github.com/JLHwung">@JLHwung</a>)</li><li>Jamie Kyle (<ahref="https://redirect.github.com/jamiebuilds-signal">@jamiebuilds-signal</a>)</li><li>Nicolò Ribaudo (<ahref="https://redirect.github.com/nicolo-ribaudo">@nicolo-ribaudo</a>)</li><li><a href="https://redirect.github.com/liuxingbaoyu">@liuxingbaoyu</a></li></ul> </li> <li><b>7.26.8</b> - <ahref="https://redirect.github.com/babel/babel/releases/tag/v7.26.8">2025-02-08</a></br><h2>v7.26.8(2025-02-08)</h2><h4>🏠 Internal</h4><ul><li><code>babel-preset-env</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17097"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17097/hovercard">#17097</a> Updatedependency babel-plugin-polyfill-corejs3 to ^0.11.0</li></ul></li></ul> </li> <li><b>7.26.7</b> - <ahref="https://redirect.github.com/babel/babel/releases/tag/v7.26.7">2025-01-24</a></br><h2>v7.26.7(2025-01-24)</h2><p>Thanks <a data-hovercard-type="user"data-hovercard-url="/users/branchseer/hovercard"data-octo-click="hovercard-link-click"data-octo-dimensions="link_type:self"href="https://redirect.github.com/branchseer">@ branchseer</a> and <aclass="user-mention notranslate" data-hovercard-type="user"data-hovercard-url="/users/tquetano-netflix/hovercard"data-octo-click="hovercard-link-click"data-octo-dimensions="link_type:self"href="https://redirect.github.com/tquetano-netflix">@tquetano-netflix</a> for your first PRs!</p><h4>🐛 Bug Fix</h4><ul><li><code>babel-helpers</code>, <code>babel-preset-env</code>,<code>babel-runtime-corejs3</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17086"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17086/hovercard">#17086</a> Make"object without properties" helpers ES6-compatible (<ahref="https://redirect.github.com/tquetano-netflix">@tquetano-netflix</a>)</li></ul></li><li><code>babel-plugin-transform-typeof-symbol</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17085"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17085/hovercard">#17085</a> fix:Correctly handle <code>typeof</code> in arrow functions (<ahref="https://redirect.github.com/liuxingbaoyu">@ liuxingbaoyu</a>)</li></ul></li><li><code>babel-parser</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17079"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17079/hovercard">#17079</a>Respect <code>ranges</code> option in estree method value (<ahref="https://redirect.github.com/JLHwung">@ JLHwung</a>)</li></ul></li><li><code>babel-core</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17052"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17052/hovercard">#17052</a> Do nottry to parse .ts configs as JSON if natively supported (<ahref="https://redirect.github.com/nicolo-ribaudo">@nicolo-ribaudo</a>)</li></ul></li><li><code>babel-plugin-transform-typescript</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17050"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17050/hovercard">#17050</a> fix:correctly resolve references to non-constant enum members (<ahref="https://redirect.github.com/branchseer">@ branchseer</a>)</li></ul></li><li><code>babel-plugin-transform-typescript</code>,<code>babel-traverse</code>, <code>babel-types</code><ul><li><a href="https://redirect.github.com/babel/babel/pull/17025"data-hovercard-type="pull_request"data-hovercard-url="/babel/babel/pull/17025/hovercard">#17025</a> fix:Remove type-only <code>import x = y.z</code> (<ahref="https://redirect.github.com/liuxingbaoyu">@ liuxingbaoyu</a>)</li></ul></li></ul><h4>Committers: 6</h4><ul><li>Babel Bot (<a href="https://redirect.github.com/babel-bot">@babel-bot</a>)</li><li>Huáng Jùnliàng (<a href="https://redirect.github.com/JLHwung">@JLHwung</a>)</li><li>Nicolò Ribaudo (<ahref="https://redirect.github.com/nicolo-ribaudo">@nicolo-ribaudo</a>)</li><li>Tony Quetano (<ahref="https://redirect.github.com/tquetano-netflix">@tquetano-netflix</a>)</li><li><a href="https://redirect.github.com/branchseer">@branchseer</a></li><li><a href="https://redirect.github.com/liuxingbaoyu">@liuxingbaoyu</a></li></ul> </li> </ul>from <ahref="https://redirect.github.com/babel/babel/releases">@babel/coreGitHub release notes</a> </details></details>---> [!IMPORTANT]>> - Check the changes in this PR to ensure they won't cause issues withyour project.> - This PR was automatically created by Snyk using the credentials of areal user.---**Note:** _You are seeing this because you or someone else with accessto this repository has authorized Snyk to open upgrade PRs._**For more information:** <imgsrc="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiIxOGYyNGI4ZC0yYjIxLTQyODAtODBjZi00NjczMTQzMWRjNDIiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjE4ZjI0YjhkLTJiMjEtNDI4MC04MGNmLTQ2NzMxNDMxZGM0MiJ9fQ=="width="0" height="0"/>> - 🧐 [View latest projectreport](https://app.snyk.io/org/reisene/project/55e114f8-489e-4f14-b900-20574b041e59?utm_source=github-cloud-app&utm_medium=referral&page=upgrade-pr)> - 📜 [Customise PRtemplates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template)> - 🛠 [Adjust upgrade PRsettings](https://app.snyk.io/org/reisene/project/55e114f8-489e-4f14-b900-20574b041e59/settings/integration?utm_source=github-cloud-app&utm_medium=referral&page=upgrade-pr)> - 🔕 [Ignore this dependency or unsubscribe from future upgradePRs](https://app.snyk.io/org/reisene/project/55e114f8-489e-4f14-b900-20574b041e59/settings/integration?pkg=@babel/core&utm_source=github-cloud-app&utm_medium=referral&page=upgrade-pr#auto-dep-upgrades)[//]: #'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"@babel/core","from":"7.26.7","to":"7.27.1"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"18f24b8d-2b21-4280-80cf-46731431dc42","prPublicId":"18f24b8d-2b21-4280-80cf-46731431dc42","packageManager":"npm","priorityScoreList":[],"projectPublicId":"55e114f8-489e-4f14-b900-20574b041e59","projectUrl":"https://app.snyk.io/org/reisene/project/55e114f8-489e-4f14-b900-20574b041e59?utm_source=github-cloud-app&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":4,"publishedDate":"2025-04-30T15:09:25.758Z"},"vulns":[]}'## Podsumowanie wygenerowane przez SourceryPrace porządkowe:- Podniesienie wersji zależności @babel/core do 7.27.1<details><summary>Original summary in English</summary>## Summary by SourceryChores:- Bump @babel/core dependency to 7.27.1</details>
Uh oh!
There was an error while loading.Please reload this page.
Fixes#5233. Unwraps do expressions to allow early exits.
Previously, the do expressions are transformed into an immediately invoked function expression, which will make
break
/continue
/return
to the outer scopes not working (which should, according to theproposal).In this PR, the do expressions are flattened to multiple statements, to address this problem. This is done by:
_do1
.Example Input
Example Output
Todos
Since these are rather edge cases, I am not going to implement them if not required.
const { [do { return; }]: do { return; } } = x
will use the old IIFE approach, because I can't think of a way to do it correctly except to downgrade the whole object restructuring pattern.a ||= do { ... }
is not supported yet. Instead, an explicit error is thrown.