diff --git a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/builtins/IrBuiltInsMapGenerated.kt b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/builtins/IrBuiltInsMapGenerated.kt index 26a6ae0481a..6603fd13132 100644 --- a/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/builtins/IrBuiltInsMapGenerated.kt +++ b/compiler/ir/ir.interpreter/src/org/jetbrains/kotlin/ir/interpreter/builtins/IrBuiltInsMapGenerated.kt @@ -197,6 +197,9 @@ internal fun interpretUnaryFunction(name: String, type: String, a: Any?): Any? { "CHECK_NOT_NULL" -> when (type) { "T0?" -> return a!! } + "code" -> when (type) { + "Char" -> return (a as Char).code + } } throw InterpreterMethodNotFoundError("Unknown function: $name($type)") } diff --git a/generators/interpreter/GenerateInterpreterMap.kt b/generators/interpreter/GenerateInterpreterMap.kt index 05f955db4f4..80d9075d096 100644 --- a/generators/interpreter/GenerateInterpreterMap.kt +++ b/generators/interpreter/GenerateInterpreterMap.kt @@ -55,6 +55,7 @@ fun generateMap(): String { val irNullCheck = irBuiltIns.checkNotNullSymbol.owner this += Operation(irNullCheck.name.asString(), listOf("T0?"), customExpression = "a!!") this += Operation("toString", listOf("Any?"), customExpression = "a?.toString() ?: \"null\"") + this += Operation("code", listOf("Char"), customExpression = "(a as Char).code") // TODO next operation can be dropped after serialization introduction this += Operation("toString", listOf("Unit"), customExpression = "Unit.toString()") })