refactor(ReferenceBuilder): Refactor getting type refeference from TypeVariableBinding #3991
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.
#3965
Extracts getting a type reference from a TypeVariableBinding into a separate method. This is pretty incredibly complicated, so I aim to also simplify the process.
This is the final significant PR in refactoring
ReferenceBuilder.getTypeReference
, but I intend to do one final PR after this to slightly refactor the top-level method. Then I'm happy.UPDATE: I've now finished this refactoring. It was hard, it took me several hours to sort out which part was doing what. In the end, I managed to significantly flatten the structure, and even remove the
bounds
field entirely (which I initially had a really hard time understanding the purpose of). Note that I didn't put it in a local variable instead, the value just isn't needed anymore.On a side note, I'm really proud of the fact that I extracted the building of a type reference from a type variable binding into six methods, yet only increased the line count by 3 lines :)