refactor(cache): split a getCached function out#360
Merged
ezolenko merged 1 commit intoJun 24, 2022
Conversation
- basically, refactor the `getDiagnostics` a tiny bit to also handle what the `getCompiled` function needs
- then just call `getCached` from both instead
- `getDiagnostics` and `getCompiled` were near identical except for the cache they used and `checkImports`, which are both parameters now
- `getCompiled` also had a logging statement (called in both `noCache` and w/ cache branches), which was moved to before the call to `getCompiled` instead
- the `type` param was composed into another function in `getDiagnostics` before the call too `getCached` now
- this simplifies all the cache code to one main function now
- remove the `markAsDirty` call under `noCache`, as well, "dirty" has no meaning for `noCache` anyway
- this simplifies that one `if` statement now too
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Decent size simplification in
tscacheso thatgetDiagnosticsandgetCompiledcall a commongetCachedfunction, which is just a tiny refactor of the code thatgetDiagnosticsalready had.Details
basically, refactor the
getDiagnosticsa tiny bit to also handle what thegetCompiledfunction needsgetCachedfrom both insteadgetDiagnosticsandgetCompiledwere near identical except for the cache they used andcheckImports, which are both parameters nowgetCompiledalso had a logging statement (called in bothnoCacheand w/ cache branches), which was moved to before the call togetCompiledinsteadtypeparam was composed into another function ingetDiagnosticsbefore the call toogetCachednowremove the
markAsDirtycall undernoCache, as well, "dirty" has no meaning fornoCacheanywayifstatement now tooReferences
checkImportsis actually buggy per my investigation in Cache not invalidating declarations when import changes (need to useclean: true) #292 (comment)truewhendeclarationistrueingetCompiledcleanmethod #358 etc