Skip to content

fix(lexer): distinguish yield identifiers from generator expressions - #138

Closed
BridgeAR wants to merge 1 commit into
mainfrom
BridgeAR/2026-10-27-issue20
Closed

BridgeAR wants to merge 1 commit into
mainfrom
BridgeAR/2026-10-27-issue20

Conversation

@BridgeAR

Copy link
Copy Markdown
Member

The slash classifier treats yield as a keyword in ordinary functions, where sloppy mode allows it as an identifier. This can hide subsequent exports or reject valid source.

Resolve function context only at ambiguous yield / sequences and retain the scan position so repeated ambiguities need only linear work.

Fixes: #20

The slash classifier treats yield as a keyword in ordinary functions, where
sloppy mode allows it as an identifier. This can hide subsequent exports or
reject valid source. Resolve function context only at ambiguous yield slashes
and retain the scan position so repeated ambiguities need only linear work.

Fixes: #20
Signed-off-by: Ruben Bridgewater <ruben.bridgewater@datadoghq.com>
@guybedford

Copy link
Copy Markdown
Collaborator

Thanks for digging into this one, and for the thorough test coverage! yield is only an identifier in sloppy-mode non-generator functions, which real code doesn't hit in practice (the original report on #20 notes the same). Supporting it means a second tokenizer and a ~20% size increase, which isn't worth it for this case, so I'm going to close this as won't-fix. Thanks again.

@guybedford guybedford closed this Nov 19, 2026
@guybedford guybedford mentioned this pull request Nov 19, 2026
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.

Export not detected

2 participants