Provide incremental analysis of a file when it is applicable

#KT32868 Fixed
This commit is contained in:
Vladimir Dolzhenko
2019-07-27 16:18:53 +02:00
parent c7bd6d8ede
commit 4b2834c4a8
68 changed files with 730 additions and 318 deletions
@@ -34,12 +34,12 @@ open class DelegatingBindingTrace(
allowSliceRewrite: Boolean = false
) : BindingTrace {
private val map = if (BindingTraceContext.TRACK_REWRITES && !allowSliceRewrite)
protected val map = if (BindingTraceContext.TRACK_REWRITES && !allowSliceRewrite)
TrackingSlicedMap(BindingTraceContext.TRACK_WITH_STACK_TRACES)
else
SlicedMapImpl(allowSliceRewrite)
private val mutableDiagnostics: MutableDiagnosticsWithSuppression?
protected val mutableDiagnostics: MutableDiagnosticsWithSuppression?
private inner class MyBindingContext : BindingContext {
override fun getDiagnostics(): Diagnostics = mutableDiagnostics ?: Diagnostics.EMPTY
@@ -99,16 +99,15 @@ open class DelegatingBindingTrace(
record(slice, key, true)
}
override fun <K, V> get(slice: ReadOnlySlice<K, V>, key: K): V? {
val value = map.get(slice, key)
if (slice is SetSlice<*>) {
assert(value != null)
if (value != SetSlice.DEFAULT) return value
} else if (value != null) {
return value
}
override fun <K, V> get(slice: ReadOnlySlice<K, V>, key: K): V? =
selfGet(slice, key) ?: parentContext.get(slice, key)
return parentContext.get(slice, key)
protected fun <K, V> selfGet(slice: ReadOnlySlice<K, V>, key: K): V? {
val value = map.get(slice, key)
return if (slice is SetSlice<*>) {
assert(value != null)
if (value != SetSlice.DEFAULT) value else null
} else value
}
override fun <K, V> getKeys(slice: WritableSlice<K, V>): Collection<K> {
@@ -145,7 +144,7 @@ open class DelegatingBindingTrace(
BindingContextUtils.addOwnDataTo(trace, filter, commitDiagnostics, map, mutableDiagnostics)
}
fun clear() {
open fun clear() {
map.clear()
mutableDiagnostics?.clear()
}