[Generator] Generate Char class

This commit is contained in:
Ivan Kylchik
2023-07-21 18:41:12 +02:00
committed by Space Team
parent 38e434bc07
commit ee973c0ede
12 changed files with 995 additions and 154 deletions
+48 -39
View File
@@ -1,18 +1,15 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
// Auto-generated file. DO NOT EDIT!
package kotlin
import kotlin.wasm.internal.*
/**
* Represents a 16-bit Unicode character.
*
* On the JVM, non-nullable values of this type are represented as values of the primitive type `char`.
*/
/** Represents a 16-bit Unicode character. */
@WasmAutoboxed
@Suppress("NOTHING_TO_INLINE")
public class Char private constructor(private val value: Char) : Comparable<Char> {
@@ -26,13 +23,6 @@ public class Char private constructor(private val value: Char) : Comparable<Char
public override fun compareTo(other: Char): Int =
wasm_i32_compareTo(this.toInt(), other.toInt())
@kotlin.internal.IntrinsicConstEvaluation
public override fun equals(other: Any?): Boolean {
if (other is Char)
return wasm_i32_eq(this.toInt(), other.toInt())
return false
}
/** Adds the other Int value to this value resulting a Char. */
@kotlin.internal.IntrinsicConstEvaluation
public inline operator fun plus(other: Int): Char =
@@ -79,6 +69,8 @@ public class Char private constructor(private val value: Char) : Comparable<Char
this until other
/** Returns the value of this character as a `Byte`. */
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toByte()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.internal.IntrinsicConstEvaluation
public inline fun toByte(): Byte =
this.toInt().toByte()
@@ -89,27 +81,37 @@ public class Char private constructor(private val value: Char) : Comparable<Char
this
/** Returns the value of this character as a `Short`. */
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toShort()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.internal.IntrinsicConstEvaluation
public inline fun toShort(): Short =
this.toInt().toShort()
/** Returns the value of this character as a `Int`. */
@WasmNoOpCast
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.internal.IntrinsicConstEvaluation
@WasmNoOpCast
public fun toInt(): Int =
implementedAsIntrinsic
/** Returns the value of this character as a `Long`. */
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toLong()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.internal.IntrinsicConstEvaluation
public inline fun toLong(): Long =
this.toInt().toLong()
/** Returns the value of this character as a `Float`. */
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toFloat()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.internal.IntrinsicConstEvaluation
public inline fun toFloat(): Float =
this.toInt().toFloat()
/** Returns the value of this character as a `Double`. */
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code.toDouble()"))
@DeprecatedSinceKotlin(warningSince = "1.5")
@kotlin.internal.IntrinsicConstEvaluation
public inline fun toDouble(): Double =
this.toInt().toDouble()
@@ -121,6 +123,13 @@ public class Char private constructor(private val value: Char) : Comparable<Char
return array.createString()
}
@kotlin.internal.IntrinsicConstEvaluation
public override fun equals(other: Any?): Boolean {
if (other is Char)
return wasm_i32_eq(this.toInt(), other.toInt())
return false
}
override fun hashCode(): Int =
this.toInt().hashCode()
@@ -167,31 +176,6 @@ public class Char private constructor(private val value: Char) : Comparable<Char
*/
public const val MAX_SURROGATE: Char = MAX_LOW_SURROGATE
/**
* The minimum value of a supplementary code point, `\u0x10000`.
*/
internal const val MIN_SUPPLEMENTARY_CODE_POINT: Int = 0x10000
/**
* The minimum value of a Unicode code point.
*/
internal const val MIN_CODE_POINT = 0x000000
/**
* The maximum value of a Unicode code point.
*/
internal const val MAX_CODE_POINT = 0X10FFFF
/**
* The minimum radix available for conversion to and from strings.
*/
internal const val MIN_RADIX: Int = 2
/**
* The maximum radix available for conversion to and from strings.
*/
internal const val MAX_RADIX: Int = 36
/**
* The number of bytes used to represent a Char in a binary form.
*/
@@ -203,5 +187,30 @@ public class Char private constructor(private val value: Char) : Comparable<Char
*/
@SinceKotlin("1.3")
public const val SIZE_BITS: Int = 16
/**
* The minimum value of a supplementary code point, `\u0x10000`.
*/
internal const val MIN_SUPPLEMENTARY_CODE_POINT: Int = 0x10000
/**
* The minimum value of a Unicode code point.
*/
internal const val MIN_CODE_POINT: Int = 0x000000
/**
* The maximum value of a Unicode code point.
*/
internal const val MAX_CODE_POINT: Int = 0X10FFFF
/**
* The minimum radix available for conversion to and from strings.
*/
internal const val MIN_RADIX: Int = 2
/**
* The maximum radix available for conversion to and from strings.
*/
internal const val MAX_RADIX: Int = 36
}
}