Make dead code indexing use a Model to index methods #565
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.
Follow-up on #564.
This time, we switch the indexing of methods to Model:
on_define_method
(7344efe)There is 2 slight behavior changes
Before we were able to look at the nesting context when defining methods inside a
no_commands
block in Thor classes. So with this code:We could tell that
foo
was defined inside ano_commands do ... end
block and thus not ignore it as other Thor commands.To avoid carrying the
no_commands do ... end
information and putting pressure on the GC, I dropped this feature, sofoo
will be marked as ignored.This is a regression that I deemed acceptable. We can revisit this later.
The
Model::Builder
ignores methods defined on receivers other thanself
. Sodef FOO.foo
anddef foo.foo
will be ignored and not marked as dead. The previous indexing was clanky anyway and this form is pretty rare. We can revisit this later.This PR is easier to review commit by commit.