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 resolve request #1323

Merged
merged 26 commits into from
May 2, 2021
Merged

Refactor resolve request #1323

merged 26 commits into from
May 2, 2021

Conversation

notaphplover
Copy link
Member

@notaphplover notaphplover commented May 1, 2021

Description

  • _resolveRequest function has been refactored to extract a _resolveBinding function.
  • Added generic T type to resolveInstance call at _resolveRequest.
  • Renamed Binding T generic to TActivated.
  • Updated Binding.factory to be FactoryCreator<TActivated> | null.

Related Issue

#1321, #1322

Motivation and Context

This change reduces the code complexity of the _resolveRequest funcion and also adds more concrete types

How Has This Been Tested?

  • Code compiles
  • All test passes successfully

Types of changes

  • Updated docs / Refactor code / Added a tests case (non-breaking change)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the changelog.

@PodaruDragos
Copy link
Contributor

PodaruDragos commented May 1, 2021 via email

@notaphplover
Copy link
Member Author

notaphplover commented May 1, 2021

There's a test failing on node 14 (es6), I'll have a look but I'll be missing for some hours. @tonyhallett could you have a look?

EDIT: if it actually sounds rude, I'm just asking a favor 😃 (english is not my first language, sry)

Copy link
Member Author

@notaphplover notaphplover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! I think it's possible to reduce the complexity of those functions, I can go for it this night

src/resolution/resolver.ts Outdated Show resolved Hide resolved
src/resolution/resolver.ts Outdated Show resolved Hide resolved
@tonyhallett
Copy link
Contributor

@notaphplover @PodaruDragos Ok to squash and merge ?

@tonyhallett
Copy link
Contributor

done making changes

@notaphplover
Copy link
Member Author

done making changes

I'm back at home, on my way to review it :)

@notaphplover
Copy link
Member Author

Ok I have some changes to request, I already have them unstaged on my local repo so if you agree I can easily push them

Copy link
Member Author

@notaphplover notaphplover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the changes :)

src/resolution/resolver.ts Outdated Show resolved Hide resolved
src/scope/scope.ts Outdated Show resolved Hide resolved
src/scope/scope.ts Outdated Show resolved Hide resolved
src/utils/binding_utils.ts Outdated Show resolved Hide resolved
src/utils/binding_utils.ts Outdated Show resolved Hide resolved
src/utils/binding_utils.ts Outdated Show resolved Hide resolved
src/utils/binding_utils.ts Outdated Show resolved Hide resolved
@tonyhallett
Copy link
Contributor

Ok I have some changes to request, I already have them unstaged on my local repo so if you agree I can easily push them

Please do !

Copy link
Contributor

@tonyhallett tonyhallett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only other thing that could be done is to further replace T with TActivated. I personally don't mind if we do this at a later stage.

src/resolution/resolver.ts Outdated Show resolved Hide resolved
src/resolution/resolver.ts Show resolved Hide resolved
Copy link
Member Author

@notaphplover notaphplover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I think we can squash and merge once the changelog has the BCs!

@tonyhallett
Copy link
Contributor

Ok can I leave that with you ?

@notaphplover
Copy link
Member Author

Ok can I leave that with you ?

I said to add BC to the changelog because I read #1319, but im not sure now. I think the cache refactor task is the right one

@notaphplover
Copy link
Member Author

So, I think we can squash and merge now, Ill do it this afternoon, once Im at home :)

@notaphplover notaphplover merged commit 9f6f43e into master May 2, 2021
@notaphplover notaphplover deleted the refactor-resolve-request branch May 2, 2021 14:13
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.

3 participants