[FIR] Fix break/continue in try-finally in loop, ^KT-51759

This commit is contained in:
Ivan Kochurkin
2022-03-31 13:49:40 +03:00
committed by teamcity
parent e9b9322672
commit c7122c1492
9 changed files with 65 additions and 8 deletions
@@ -6,6 +6,8 @@
package org.jetbrains.kotlin.fir.resolve.dfa.cfg
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
import org.jetbrains.kotlin.fir.expressions.FirBreakExpression
import org.jetbrains.kotlin.fir.expressions.FirLoopJump
import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol
class ControlFlowGraph(val declaration: FirDeclaration?, val name: String, val kind: Kind) {
@@ -144,6 +146,11 @@ object LoopBackPath : EdgeLabel(label = null) {
object UncaughtExceptionPath : EdgeLabel(label = "onUncaughtException")
class LoopPath(
firLoopJump: FirLoopJump
) : EdgeLabel("\"" + (if (firLoopJump is FirBreakExpression) "break" else "continue") +
(firLoopJump.target.labeledElement.label?.let { "@${it.name}" } ?: "") + "\"")
// TODO: Label `return`ing edge with this.
class ReturnPath(
returnTargetSymbol: FirFunctionSymbol<*>