[IR] Combine value class lowerings
Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com> #KT-1179
This commit is contained in:
committed by
Space Team
parent
68fb8aa2a1
commit
86809e898a
+1
-1
@@ -30,7 +30,7 @@ open class ScopeWithIr(val scope: Scope, val irElement: IrElement)
|
||||
|
||||
abstract class IrElementTransformerVoidWithContext : IrElementTransformerVoid() {
|
||||
|
||||
private val scopeStack = mutableListOf<ScopeWithIr>()
|
||||
protected open val scopeStack = mutableListOf<ScopeWithIr>()
|
||||
|
||||
protected open fun createScope(declaration: IrSymbolOwner): ScopeWithIr =
|
||||
ScopeWithIr(Scope(declaration.symbol), declaration)
|
||||
|
||||
+4
-5
@@ -20,7 +20,6 @@ import org.jetbrains.kotlin.ir.expressions.impl.*
|
||||
import org.jetbrains.kotlin.ir.symbols.IrReturnTargetSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.IrReturnableBlockSymbol
|
||||
import org.jetbrains.kotlin.ir.symbols.impl.IrReturnableBlockSymbolImpl
|
||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||
import org.jetbrains.kotlin.ir.types.IrType
|
||||
import org.jetbrains.kotlin.ir.types.isNothing
|
||||
import org.jetbrains.kotlin.ir.types.isUnit
|
||||
@@ -75,14 +74,14 @@ class FinallyBlocksLowering(val context: CommonBackendContext, private val throw
|
||||
val jumps = mutableMapOf<HighLevelJump, IrReturnTargetSymbol>()
|
||||
}
|
||||
|
||||
private val scopeStack = mutableListOf<Scope>()
|
||||
private val otherScopeStack = mutableListOf<Scope>()
|
||||
|
||||
private inline fun <S: Scope, R> using(scope: S, block: (S) -> R): R {
|
||||
scopeStack.push(scope)
|
||||
otherScopeStack.push(scope)
|
||||
try {
|
||||
return block(scope)
|
||||
} finally {
|
||||
scopeStack.pop()
|
||||
otherScopeStack.pop()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +154,7 @@ class FinallyBlocksLowering(val context: CommonBackendContext, private val throw
|
||||
endOffset: Int,
|
||||
value: IrExpression
|
||||
): IrExpression? {
|
||||
val tryScopes = scopeStack.reversed()
|
||||
val tryScopes = otherScopeStack.reversed()
|
||||
.takeWhile { !targetScopePredicate(it) }
|
||||
.filterIsInstance<TryScope>()
|
||||
.toList()
|
||||
|
||||
Reference in New Issue
Block a user