Skip to content

Commit

Permalink
PERF: use strict = false when finding mod tracker owner in the cache
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad20012 committed Jul 26, 2019
1 parent a76cdf3 commit 489dfe3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -32,7 +32,7 @@ interface RsModificationTrackerOwner : RsElement {
fun incModificationCount(element: PsiElement): Boolean
}

fun PsiElement.findModificationTrackerOwner(strict: Boolean = true): RsModificationTrackerOwner? {
fun PsiElement.findModificationTrackerOwner(strict: Boolean): RsModificationTrackerOwner? {
return PsiTreeUtil.getContextOfType(
this,
strict,
Expand Down
Expand Up @@ -122,7 +122,7 @@ class RsResolveCache(messageBus: MessageBus) {
private fun getCacheFor(element: PsiElement, dep: ResolveCacheDependency): ConcurrentMap<PsiElement, Any?> {
return when (dep) {
ResolveCacheDependency.LOCAL, ResolveCacheDependency.LOCAL_AND_RUST_STRUCTURE -> {
val owner = element.findModificationTrackerOwner()
val owner = element.findModificationTrackerOwner(strict = false)
return if (owner != null) {
if (dep == ResolveCacheDependency.LOCAL) {
CachedValuesManager.getCachedValue(owner, LOCAL_CACHE_KEY) {
Expand Down

0 comments on commit 489dfe3

Please sign in to comment.