Fix diagnostics calculations for incremental analysis
This commit is contained in:
+8
-5
@@ -261,9 +261,9 @@ private class StackedCompositeBindingContextTrace(
|
|||||||
/**
|
/**
|
||||||
* All diagnostics from parentContext apart those diagnostics those belongs to the element or its descendants
|
* All diagnostics from parentContext apart those diagnostics those belongs to the element or its descendants
|
||||||
*/
|
*/
|
||||||
val parentDiagnosticsApartElement: List<Diagnostic> = parentContext.diagnostics.all().filter { d ->
|
val parentDiagnosticsApartElement: Collection<Diagnostic> = parentContext.diagnostics.all().filter { d ->
|
||||||
d.psiElement.parentsWithSelf.none { it == element }
|
d.psiElement.parentsWithSelf.none { it == element }
|
||||||
}.toList()
|
}
|
||||||
|
|
||||||
inner class StackedCompositeBindingContext : BindingContext {
|
inner class StackedCompositeBindingContext : BindingContext {
|
||||||
var cachedDiagnostics: Diagnostics? = null
|
var cachedDiagnostics: Diagnostics? = null
|
||||||
@@ -279,9 +279,12 @@ private class StackedCompositeBindingContextTrace(
|
|||||||
|
|
||||||
override fun getDiagnostics(): Diagnostics {
|
override fun getDiagnostics(): Diagnostics {
|
||||||
if (cachedDiagnostics == null) {
|
if (cachedDiagnostics == null) {
|
||||||
val diagnosticList =
|
val mergedDiagnostics = mutableSetOf<Diagnostic>()
|
||||||
parentDiagnosticsApartElement + (this@StackedCompositeBindingContextTrace.mutableDiagnostics?.all() ?: emptyList())
|
mergedDiagnostics.addAll(parentDiagnosticsApartElement)
|
||||||
cachedDiagnostics = MergedDiagnostics(diagnosticList, parentContext.diagnostics.modificationTracker)
|
this@StackedCompositeBindingContextTrace.mutableDiagnostics?.all()?.let {
|
||||||
|
mergedDiagnostics.addAll(it)
|
||||||
|
}
|
||||||
|
cachedDiagnostics = MergedDiagnostics(mergedDiagnostics, parentContext.diagnostics.modificationTracker)
|
||||||
}
|
}
|
||||||
return cachedDiagnostics!!
|
return cachedDiagnostics!!
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user