FIR DFA: fix mismatched calls to enter/exitProperty
Otherwise the graph stack becomes incorrect.
This commit is contained in:
+5
-2
@@ -584,8 +584,11 @@ class ControlFlowGraphBuilder {
|
||||
|
||||
// ----------------------------------- Property -----------------------------------
|
||||
|
||||
private val FirProperty.hasInitialization: Boolean
|
||||
get() = initializer != null || delegate != null || hasExplicitBackingField
|
||||
|
||||
fun enterProperty(property: FirProperty): PropertyInitializerEnterNode? {
|
||||
if (property.initializer == null && property.delegate == null && !property.hasExplicitBackingField) return null
|
||||
if (!property.hasInitialization) return null
|
||||
|
||||
val graph = ControlFlowGraph(property, "val ${property.name}", ControlFlowGraph.Kind.PropertyInitializer)
|
||||
pushGraph(graph, Mode.PropertyInitializer)
|
||||
@@ -603,7 +606,7 @@ class ControlFlowGraphBuilder {
|
||||
}
|
||||
|
||||
fun exitProperty(property: FirProperty): Pair<PropertyInitializerExitNode, ControlFlowGraph>? {
|
||||
if (property.initializer == null && property.delegate == null && !property.hasExplicitBackingField) return null
|
||||
if (!property.hasInitialization) return null
|
||||
val exitNode = exitTargetsForTry.pop() as PropertyInitializerExitNode
|
||||
popAndAddEdge(exitNode)
|
||||
val graph = popGraph()
|
||||
|
||||
+3
-1
@@ -135,11 +135,13 @@ open class FirDeclarationsResolveTransformer(transformer: FirAbstractBodyResolve
|
||||
}
|
||||
|
||||
property.transformReceiverParameter(transformer, ResolutionMode.ContextIndependent)
|
||||
dataFlowAnalyzer.enterProperty(property)
|
||||
doTransformTypeParameters(property)
|
||||
val shouldResolveEverything = !implicitTypeOnly
|
||||
return withFullBodyResolve {
|
||||
val initializerIsAlreadyResolved = bodyResolveState >= FirPropertyBodyResolveState.INITIALIZER_RESOLVED
|
||||
if (!initializerIsAlreadyResolved) {
|
||||
dataFlowAnalyzer.enterProperty(property)
|
||||
}
|
||||
var backingFieldIsAlreadyResolved = false
|
||||
context.withProperty(property) {
|
||||
context.forPropertyInitializer {
|
||||
|
||||
Reference in New Issue
Block a user