FIR: don't call a graph builder method in finally
If an exception is thrown, trying to add more nodes to a graph that's already missing entire subgraphs may not end well.
This commit is contained in:
+3
-9
@@ -1122,9 +1122,7 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
|
|||||||
}
|
}
|
||||||
|
|
||||||
dataFlowAnalyzer.enterDelegatedConstructorCall()
|
dataFlowAnalyzer.enterDelegatedConstructorCall()
|
||||||
var callCompleted = true
|
|
||||||
var result = delegatedConstructorCall
|
|
||||||
try {
|
|
||||||
val lastDispatchReceiver = implicitReceiverStack.lastDispatchReceiver()
|
val lastDispatchReceiver = implicitReceiverStack.lastDispatchReceiver()
|
||||||
context.forDelegatedConstructorCall(containingConstructor, containingClass as? FirRegularClass, components) {
|
context.forDelegatedConstructorCall(containingConstructor, containingClass as? FirRegularClass, components) {
|
||||||
delegatedConstructorCall.transformChildren(transformer, ResolutionMode.ContextDependent)
|
delegatedConstructorCall.transformChildren(transformer, ResolutionMode.ContextDependent)
|
||||||
@@ -1151,13 +1149,9 @@ open class FirExpressionsResolveTransformer(transformer: FirAbstractBodyResolveT
|
|||||||
|
|
||||||
// it seems that we may leave this code as is
|
// it seems that we may leave this code as is
|
||||||
// without adding `context.withTowerDataContext(context.getTowerDataContextForConstructorResolution())`
|
// without adding `context.withTowerDataContext(context.getTowerDataContextForConstructorResolution())`
|
||||||
val completionResult = callCompleter.completeCall(resolvedCall, noExpectedType)
|
val (result, callCompleted) = callCompleter.completeCall(resolvedCall, noExpectedType)
|
||||||
result = completionResult.result
|
|
||||||
callCompleted = completionResult.callCompleted
|
|
||||||
return result
|
|
||||||
} finally {
|
|
||||||
dataFlowAnalyzer.exitDelegatedConstructorCall(result, callCompleted)
|
dataFlowAnalyzer.exitDelegatedConstructorCall(result, callCompleted)
|
||||||
}
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun extractSuperTypeDeclaration(typeRef: FirTypeRef): FirRegularClass? {
|
private fun extractSuperTypeDeclaration(typeRef: FirTypeRef): FirRegularClass? {
|
||||||
|
|||||||
Reference in New Issue
Block a user