Migrate deprecations in Native compiler

Replacing deprecated Char.toInt() with Char.code and
Number.toChar() with Number.toInt().toChar(), where Number is not Int.

KT-23451
This commit is contained in:
Ilya Gorbunov
2021-04-06 20:44:24 +03:00
parent e450a6494a
commit 833955e56d
5 changed files with 7 additions and 7 deletions
@@ -128,7 +128,7 @@ internal class Int16(val value: Short) : ConstValue {
}
internal class Char16(val value: Char) : ConstValue {
override val llvm = LLVMConstInt(int16Type, value.toLong(), 1)!!
override val llvm = LLVMConstInt(int16Type, value.code.toLong(), 1)!!
}
internal class Int32(val value: Int) : ConstValue {
@@ -173,6 +173,6 @@ internal class StaticData(override val context: Context): ContextUtils {
* @param args data for constant creation.
*/
internal fun StaticData.createImmutableBlob(value: IrConst<String>): LLVMValueRef {
val args = value.value.map { Int8(it.toByte()).llvm }
val args = value.value.map { Int8(it.code.toByte()).llvm }
return createConstKotlinArray(context.ir.symbols.immutableBlob.owner, args)
}
@@ -87,7 +87,7 @@ internal class PostInlineLowering(val context: Context) : BodyLoweringPass {
// Luckily, all values in range 0x00 .. 0xff represent valid UTF-16 symbols,
// block 0 (Basic Latin) and block 1 (Latin-1 Supplement) in
// Basic Multilingual Plane, so we could just append data "as is".
builder.append(value.toChar())
builder.append(value.toInt().toChar())
}
expression.putValueArgument(0, IrConstImpl(
expression.startOffset, expression.endOffset,