fix: handle new of conflict cases#195
Merged
Merged
Conversation
Disambiguate `of` as identifier vs for-of contextual keyword inside `for (...)` by checking whether `of` actually follows a binding (the only place the for-of keyword can appear). In valid JS a binding always ends with an identifier-tail char, ']', '}', or ')' — anything else means `of` is just an identifier and the following `/` is division, not the start of a regex. Adds isForOfBinding which scans backward through whitespace from the char before `of` and checks that terminator. This is more robust than the previous fixed-offset exclusion list (which only excluded ';' and '=', missing '+', '-', '*', ',', '<', '|', '&', '?', etc.) and also handles tab/newline whitespace and the no-space-before-of cases like `for ([x]of /regex/)`. Fixes #188.
mergify Bot
added a commit
to ArcadeData/arcadedb
that referenced
this pull request
Apr 26, 2026
…2.1.0 in /studio [skip ci] Bumps [es-module-lexer](https://github.com/guybedford/es-module-lexer) from 2.0.0 to 2.1.0. Release notes *Sourced from [es-module-lexer's releases](https://github.com/guybedford/es-module-lexer/releases).* > 2.1.0 > ----- > > What's Changed > -------------- > > * Always exclude dyn import attributes from specifier range by [`@nicolo-ribaudo`](https://github.com/nicolo-ribaudo) in [guybedford/es-module-lexer#197](https://redirect.github.com/guybedford/es-module-lexer/pull/197) > * fix: handle new of conflict cases by [`@guybedford`](https://github.com/guybedford) in [guybedford/es-module-lexer#195](https://redirect.github.com/guybedford/es-module-lexer/pull/195) > > New Contributors > ---------------- > > * [`@nicolo-ribaudo`](https://github.com/nicolo-ribaudo) made their first contribution in [guybedford/es-module-lexer#197](https://redirect.github.com/guybedford/es-module-lexer/pull/197) > > **Full Changelog**: <guybedford/es-module-lexer@2.0.0...2.1.0> Commits * [`5fb11e1`](guybedford/es-module-lexer@5fb11e1) 2.1.0 * [`cc29c5b`](guybedford/es-module-lexer@cc29c5b) fix: handle new of conflict cases ([#195](https://redirect.github.com/guybedford/es-module-lexer/issues/195)) * [`4a35138`](guybedford/es-module-lexer@4a35138) Always exclude dyn import attributes from specifier range ([#197](https://redirect.github.com/guybedford/es-module-lexer/issues/197)) * See full diff in [compare view](guybedford/es-module-lexer@2.0.0...2.1.0) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
tae898
pushed a commit
to humemai/arcadedb-embedded-python
that referenced
this pull request
Jun 28, 2026
…2.1.0 in /studio [skip ci] Bumps [es-module-lexer](https://github.com/guybedford/es-module-lexer) from 2.0.0 to 2.1.0. Release notes *Sourced from [es-module-lexer's releases](https://github.com/guybedford/es-module-lexer/releases).* > 2.1.0 > ----- > > What's Changed > -------------- > > * Always exclude dyn import attributes from specifier range by [`@nicolo-ribaudo`](https://github.com/nicolo-ribaudo) in [guybedford/es-module-lexer#197](https://redirect.github.com/guybedford/es-module-lexer/pull/197) > * fix: handle new of conflict cases by [`@guybedford`](https://github.com/guybedford) in [guybedford/es-module-lexer#195](https://redirect.github.com/guybedford/es-module-lexer/pull/195) > > New Contributors > ---------------- > > * [`@nicolo-ribaudo`](https://github.com/nicolo-ribaudo) made their first contribution in [guybedford/es-module-lexer#197](https://redirect.github.com/guybedford/es-module-lexer/pull/197) > > **Full Changelog**: <guybedford/es-module-lexer@2.0.0...2.1.0> Commits * [`5fb11e1`](guybedford/es-module-lexer@5fb11e1) 2.1.0 * [`cc29c5b`](guybedford/es-module-lexer@cc29c5b) fix: handle new of conflict cases ([ArcadeData#195](https://redirect.github.com/guybedford/es-module-lexer/issues/195)) * [`4a35138`](guybedford/es-module-lexer@4a35138) Always exclude dyn import attributes from specifier range ([ArcadeData#197](https://redirect.github.com/guybedford/es-module-lexer/issues/197)) * See full diff in [compare view](guybedford/es-module-lexer@2.0.0...2.1.0) [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- Dependabot commands and options You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #188 —
ofas an identifier on the LHS of/inside aforheader was being mis-parsed as the for-of contextual keyword, causing the/to be treated as the start of a regex.Approach
Inside
for (...),ofis the for-of contextual keyword only if it follows a binding. In valid JS a binding always ends with one of:_,$)](array destructuring)}(object destructuring))(parenthesized binding)Anything else means
ofis just an identifier and the following/is division. NewisForOfBindinghelper scans backward through whitespace from the char beforeofand checks that terminator.Cases now covered
C-style for,
ofas identifier (the/is division):For-of with regex iterable (the
/regex/is still recognized as a regex):