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

[PRISM] Insert all locals in the locals index table #9663

Merged
merged 2 commits into from
Jan 24, 2024

Conversation

tenderlove
Copy link
Member

Prism provides an index (local_body_index) which is supposed to point at
the start of locals declared in the method body. Prism assumed that
method body locals would only occur after parameter names.
Unfortunately this assumption is not correct, which meant that we would
in some cases not insert all locals in the local table. This commit
iterates over locals a second time, inserting any that didn't get
inserted on the first pass.

Fixes: ruby/prism#2245

Prism provides an index (local_body_index) which is supposed to point at
the start of locals declared in the method body. Prism assumed that
method body locals would only occur _after_ parameter names.
Unfortunately this assumption is not correct, which meant that we would
in some cases not insert all locals in the local table.  This commit
iterates over locals a second time, inserting any that didn't get
inserted on the first pass.

Fixes: ruby/prism#2245

Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
@tenderlove tenderlove merged commit 578ff32 into ruby:master Jan 24, 2024
96 of 97 checks passed
@tenderlove tenderlove deleted the local-refactor branch January 24, 2024 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant