Skip to content

Fix ASI before accessor keyword identifiers#33

Merged
dy merged 1 commit into
dy:mainfrom
davejcameron:dc.asi-accessor-boundary
May 12, 2026
Merged

Fix ASI before accessor keyword identifiers#33
dy merged 1 commit into
dy:mainfrom
davejcameron:dc.asi-accessor-boundary

Conversation

@davejcameron
Copy link
Copy Markdown
Contributor

Problem

The get/set accessor parser can treat an identifier followed by a statement with a parenthesized head and block body as accessor syntax when a semicolon or line break separates them.

return set;
for (const x of xs) { y(x) }

That should parse as two statements, but the accessor parser can read it as if it were set for (...) { ... } inside the returned expression.

Fix

Reject accessor parsing when a semicolon boundary or line terminator appears between the get/set keyword candidate and the property name. In that case, get/set falls back to the normal identifier path and ASI can split the following statement correctly.

Validation

  • Direct parse check for return set; followed by a for block
  • node test/jessie.js: 71 tests, 243 assertions

@dy dy merged commit 191f60c into dy:main May 12, 2026
1 check passed
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