Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle compact inside arrow functions #339

Merged
merged 6 commits into from
Dec 1, 2024
Merged

Conversation

sirbrillig
Copy link
Owner

@sirbrillig sirbrillig commented Dec 1, 2024

The code to detect and process variables inside calls to compact() (please, stop using that function 😩) was finding and processing those variables all at once, using the scope of the compact token itself as if it were a variable. However, this does not work for compact used inside arrow functions because there are multiple possible scopes for each variable.

In this PR, we refactor the code to process each variable inside compact() separately, allowing us to determine each one's scope before determining if it is defined.

Fixes #330

@sirbrillig sirbrillig merged commit c3780f2 into 2.x Dec 1, 2024
62 checks passed
@sirbrillig sirbrillig deleted the handle-compact-in-fat-arrow branch December 1, 2024 22:31
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.

Arrow Functions and compact method cause false positive for UndefinedVariable bug
1 participant