[FIR] Fixed CFA bug
This commit is contained in:
+2
-2
@@ -47,9 +47,9 @@ class FirControlFlowAnalyzer(session: FirSession) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun runAssignmentCfaCheckers(graph: ControlFlowGraph, reporter: DiagnosticReporter) {
|
private fun runAssignmentCfaCheckers(graph: ControlFlowGraph, reporter: DiagnosticReporter) {
|
||||||
val properties = AbstractFirPropertyInitializationChecker.LocalPropertyCollector.collect(graph)
|
val properties = AbstractFirCfaPropertyAssignmentChecker.LocalPropertyCollector.collect(graph)
|
||||||
if (properties.isEmpty()) return
|
if (properties.isEmpty()) return
|
||||||
val data = AbstractFirPropertyInitializationChecker.DataCollector(properties).getData(graph)
|
val data = AbstractFirCfaPropertyAssignmentChecker.DataCollector(properties).getData(graph)
|
||||||
variableAssignmentCheckers.forEach { it.analyze(graph, reporter, data, properties) }
|
variableAssignmentCheckers.forEach { it.analyze(graph, reporter, data, properties) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-1
@@ -58,7 +58,10 @@ class ControlFlowAnalysisDiagnosticComponent(collector: AbstractDiagnosticCollec
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun visitPropertyAccessor(propertyAccessor: FirPropertyAccessor, data: CheckerContext) {
|
override fun visitPropertyAccessor(propertyAccessor: FirPropertyAccessor, data: CheckerContext) {
|
||||||
visitFunction(propertyAccessor, data)
|
val graph = propertyAccessor.controlFlowGraphReference?.controlFlowGraph ?: return
|
||||||
|
runCheck {
|
||||||
|
controlFlowAnalyzer.analyzePropertyAccessor(propertyAccessor, graph, data, it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun visitConstructor(constructor: FirConstructor, data: CheckerContext) {
|
override fun visitConstructor(constructor: FirConstructor, data: CheckerContext) {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ val o = object {
|
|||||||
p.x = 4
|
p.x = 4
|
||||||
|
|
||||||
val z : Int
|
val z : Int
|
||||||
doSmth(<!UNINITIALIZED_VARIABLE, UNINITIALIZED_VARIABLE!>z<!>)
|
doSmth(<!UNINITIALIZED_VARIABLE!>z<!>)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user