Skip to content

Fix using/await using edge cases in for loops - #1432

Merged
marijnh merged 4 commits into
acornjs:masterfrom
adams85:fix/using-edge-cases
Mar 29, 2026
Merged

Fix using/await using edge cases in for loops#1432
marijnh merged 4 commits into
acornjs:masterfrom
adams85:fix/using-edge-cases

Conversation

@adams85

@adams85 adams85 commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Currently, the following using/await using edge cases are not handled correctly:

  • for (using of = null;;) {} → should be accepted (needs lookahead)
  • for (await using of = null;;) {} → should be accepted
  • for (await using of of []) {} → should be be accepted (however, without await, it's a syntax error!)
  • for (using x in {}) {} → should be a syntax error
  • for (await using x in {}) {} → should be a syntax error
  • for (;;) using x = null, if (true) await using x = null, etc. → should be a syntax error

This PR implements the necessary changes.

@adams85
adams85 force-pushed the fix/using-edge-cases branch from d632780 to 22ddd5c Compare March 29, 2026 01:14
@marijnh
marijnh merged commit 8bd0290 into acornjs:master Mar 29, 2026
2 checks passed
@marijnh

marijnh commented Mar 29, 2026

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants