Skip to content

Conversation

JLHwung
Copy link
Contributor

@JLHwung JLHwung commented May 26, 2025

Q                       A
Fixed Issues? Improve error messages on invalid production export default using x and TS declare using x.
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

@JLHwung JLHwung added PR: Polish 💅 A type of pull request used for our changelog categories Spec: Explicit Resource Management labels May 26, 2025
@babel-bot
Copy link
Collaborator

babel-bot commented May 26, 2025

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

this.match(tt._var) ||
this.isLet() ||
(this.hasPlugin("explicitResourceManagement") &&
((this.isContextual(tt._using) && this.startsUsing()) ||
Copy link
Member

Choose a reason for hiding this comment

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

Nit: could we move the this.isContextual(tt._using) inside this.startsUsing() (and maybe rename it to isUsing, similar to isLet)? Just because we are checking this.isContextual(tt._using) first every time we call this.startsUsing() anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, we often call startsUsing in a big switch case so isContextual would introduce a duplicate using token check. But it probably has little impact on the performance.

@JLHwung JLHwung force-pushed the improve-using-declaration-errors branch from 1672fe9 to 6efb2d9 Compare May 29, 2025 17:45
@JLHwung JLHwung requested a review from liuxingbaoyu May 30, 2025 12:49
@JLHwung JLHwung force-pushed the improve-using-declaration-errors branch from c4af333 to 06e3516 Compare May 30, 2025 13:19
@@ -524,7 +549,7 @@ export default abstract class StatementParser extends ExpressionParser {

case tt._await:
// [+Await] await [no LineTerminator here] using [no LineTerminator here] BindingList[+Using]
if (!this.state.containsEsc && this.startsAwaitUsing()) {
Copy link
Member

Choose a reason for hiding this comment

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

startsAwaitUsing seems to have no reference anymore, let's remove it?

@JLHwung JLHwung merged commit d3215a2 into babel:main May 31, 2025
58 checks passed
@JLHwung JLHwung deleted the improve-using-declaration-errors branch May 31, 2025 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: Polish 💅 A type of pull request used for our changelog categories Spec: Explicit Resource Management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants