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

refactor(ReferenceBuilder): Refactor getting type refeference from TypeVariableBinding #3991

Conversation

slarse
Copy link
Collaborator

@slarse slarse commented Jun 14, 2021

#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 :)

@slarse slarse changed the title wip: refactor(ReferenceBuilder): Refactor getting type refeference from TypeVariableBinding review: refactor(ReferenceBuilder): Refactor getting type refeference from TypeVariableBinding Jun 15, 2021
@slarse slarse requested a review from monperrus June 15, 2021 08:17
@monperrus monperrus changed the title review: refactor(ReferenceBuilder): Refactor getting type refeference from TypeVariableBinding refactor(ReferenceBuilder): Refactor getting type refeference from TypeVariableBinding Jun 16, 2021
@monperrus monperrus merged commit 830326f into INRIA:master Jun 16, 2021
@monperrus
Copy link
Collaborator

Very nice! Removing state is always welcome :) Thanks @slarse

@monperrus monperrus mentioned this pull request Aug 19, 2021
woutersmeenk pushed a commit to woutersmeenk/spoon that referenced this pull request Aug 29, 2021
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.

2 participants