From 0c6d485c9c4067dffdcb6075b1f16ba3150f5f57 Mon Sep 17 00:00:00 2001 From: Ivan Kylchik Date: Wed, 17 Jun 2020 15:37:15 +0300 Subject: [PATCH] Rename ReturnLabel.NEXT to ReturnLabel.REGULAR This name better describe that this label mean: execution was finished regular and there is no need to make special processing --- .../kotlin/backend/common/interpreter/IrInterpreter.kt | 2 +- .../jetbrains/kotlin/backend/common/interpreter/Label.kt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/IrInterpreter.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/IrInterpreter.kt index 84afbc3468b..4769240d47f 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/IrInterpreter.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/IrInterpreter.kt @@ -75,7 +75,7 @@ class IrInterpreter(irModule: IrModuleFragment, private val bodyMap: Map stack.popReturnValue().toIrExpression(expression) + ReturnLabel.REGULAR -> stack.popReturnValue().toIrExpression(expression) ReturnLabel.EXCEPTION -> { val message = (stack.popReturnValue() as ExceptionState).getFullDescription() IrErrorExpressionImpl(expression.startOffset, expression.endOffset, expression.type, "\n" + message) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/Label.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/Label.kt index a93b03929e9..01ee08be3c6 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/Label.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/interpreter/Label.kt @@ -23,7 +23,7 @@ import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable import org.jetbrains.kotlin.ir.util.render enum class ReturnLabel { - NEXT, RETURN, BREAK_LOOP, BREAK_WHEN, CONTINUE, EXCEPTION + REGULAR, RETURN, BREAK_LOOP, BREAK_WHEN, CONTINUE, EXCEPTION } open class ExecutionResult(val returnLabel: ReturnLabel, private val owner: IrElement? = null) { @@ -46,7 +46,7 @@ open class ExecutionResult(val returnLabel: ReturnLabel, private val owner: IrEl else -> this } ReturnLabel.EXCEPTION -> Exception - ReturnLabel.NEXT -> Next + ReturnLabel.REGULAR -> Next } } @@ -55,7 +55,7 @@ open class ExecutionResult(val returnLabel: ReturnLabel, private val owner: IrEl } } -inline fun ExecutionResult.check(toCheckLabel: ReturnLabel = ReturnLabel.NEXT, returnBlock: (ExecutionResult) -> Unit): ExecutionResult { +inline fun ExecutionResult.check(toCheckLabel: ReturnLabel = ReturnLabel.REGULAR, returnBlock: (ExecutionResult) -> Unit): ExecutionResult { if (this.returnLabel != toCheckLabel) returnBlock(this) return this } @@ -78,7 +78,7 @@ internal fun ExecutionResult.implicitCastIfNeeded(expectedType: IrType, actualTy return this } -object Next : ExecutionResult(ReturnLabel.NEXT) +object Next : ExecutionResult(ReturnLabel.REGULAR) object Return : ExecutionResult(ReturnLabel.RETURN) object BreakLoop : ExecutionResult(ReturnLabel.BREAK_LOOP) object BreakWhen : ExecutionResult(ReturnLabel.BREAK_WHEN)