FIR IDE: use FirCaches in JavaSymbolProvider
This commit is contained in:
-17
@@ -29,23 +29,6 @@ inline class SymbolProviderCache<K, V : Any> @PrivateForInline constructor(@Priv
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(PrivateForInline::class)
|
||||
inline fun <T> lookupCacheOrCalculateWithPostCompute(
|
||||
key: K, crossinline l: (K) -> Pair<V?, T>, postCompute: (V, T) -> Unit
|
||||
): V? {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return when (val value = cache[key]) {
|
||||
null -> {
|
||||
val calculated = l(key)
|
||||
cache[key] = calculated.first ?: NullValue
|
||||
calculated.first?.let { postCompute(it, calculated.second) }
|
||||
calculated.first
|
||||
}
|
||||
NullValue -> null
|
||||
else -> value as V
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(PrivateForInline::class)
|
||||
operator fun contains(key: K): Boolean = key in cache
|
||||
|
||||
|
||||
Reference in New Issue
Block a user