[FIR] Support fields as part of graph of class initialization
^KT-49747 Fixed
This commit is contained in:
committed by
teamcityserver
parent
5778cb440f
commit
9c7058c3c5
+2
-1
@@ -408,6 +408,7 @@ class ControlFlowGraphBuilder {
|
||||
for (declaration in klass.declarations) {
|
||||
val graph = when (declaration) {
|
||||
is FirProperty -> declaration.controlFlowGraphReference?.controlFlowGraph
|
||||
is FirField -> declaration.controlFlowGraphReference?.controlFlowGraph
|
||||
is FirAnonymousInitializer -> declaration.controlFlowGraphReference?.controlFlowGraph
|
||||
else -> null
|
||||
} ?: continue
|
||||
@@ -1556,7 +1557,7 @@ class ControlFlowGraphBuilder {
|
||||
|
||||
private fun FirDeclaration.unwrap(): List<FirDeclaration> =
|
||||
when (this) {
|
||||
is FirFunction, is FirAnonymousInitializer -> listOf(this)
|
||||
is FirFunction, is FirAnonymousInitializer, is FirField -> listOf(this)
|
||||
is FirProperty -> listOfNotNull(this.getter, this.setter, this)
|
||||
else -> emptyList()
|
||||
}
|
||||
|
||||
+3
-1
@@ -215,7 +215,9 @@ open class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransfor
|
||||
if (field.initializer != null) {
|
||||
storeVariableReturnType(field)
|
||||
}
|
||||
dataFlowAnalyzer.exitField(field)
|
||||
dataFlowAnalyzer.exitField(field)?.let {
|
||||
field.replaceControlFlowGraphReference(FirControlFlowGraphReferenceImpl(it))
|
||||
}
|
||||
field
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -75,6 +75,10 @@ private class NavigationInfoVisitor : FirDefaultVisitor<Unit, Any?>() {
|
||||
visitCallableDeclaration(property, null)
|
||||
}
|
||||
|
||||
override fun visitField(field: FirField, data: Any?) {
|
||||
visitCallableDeclaration(field, null)
|
||||
}
|
||||
|
||||
override fun visitConstructor(constructor: FirConstructor, data: Any?) {
|
||||
visitCallableDeclaration(constructor, null)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user