dev/core#2823 Extract code to load the declarations and call from the constructor #21399
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.
Overview
dev/core#2823 Extract code to load the declarations and call from the constructor
Before
declarations are loaded in
getDeclarations
if not already loaded. However, there is also code to load them in the constructor which makes is confusingAfter
Always loaded in the constructor
Technical Details
The declarations are only used in object context so it makes sense to load
them in the constructor and they are always needed in usage of this class.
In addition they are ALWAYS loaded (rather than passed in) except in test usage
(it does seem a bit silly having the option to pass them in only for tests
but we can ignore that for now - I commented it)
Comments