[Generator] Generate Char class
This commit is contained in:
@@ -1227,8 +1227,8 @@ public final class Char : kotlin.Comparable<kotlin.Char> {
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public final fun toShort(): kotlin.Short
|
||||
|
||||
@kotlin.js.JsName(name = "toString")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
@kotlin.js.JsName(name = "toString")
|
||||
public open override fun toString(): kotlin.String
|
||||
|
||||
public companion object of Char {
|
||||
|
||||
@@ -1,28 +1,27 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
// Char is a magic class.
|
||||
// Char is defined as a regular class, but we lower it as a value class.
|
||||
// See [org.jetbrains.kotlin.ir.backend.js.utils.JsInlineClassesUtils.isClassInlineLike] for explanation.
|
||||
|
||||
/**
|
||||
* Represents a 16-bit Unicode character.
|
||||
* On the JVM, non-nullable values of this type are represented as values of the primitive type `char`.
|
||||
*/
|
||||
public /*value*/ class Char
|
||||
/** Represents a 16-bit Unicode character. */
|
||||
public class Char
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
internal constructor(private val value: Int) : Comparable<Char> {
|
||||
|
||||
@SinceKotlin("1.5")
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public constructor(code: UShort) : this(code.toInt())
|
||||
|
||||
/**
|
||||
* Compares this value with the specified value for order.
|
||||
*
|
||||
* Returns zero if this value is equal to the specified other value, a negative number if it's less than other,
|
||||
* or a positive number if it's greater than other.
|
||||
*/
|
||||
@@ -36,6 +35,7 @@ internal constructor(private val value: Int) : Comparable<Char> {
|
||||
/** Subtracts the other Char value from this value resulting an Int. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public operator fun minus(other: Char): Int = value - other.value
|
||||
|
||||
/** Subtracts the other Int value from this value resulting a Char. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public operator fun minus(other: Int): Char = (value - other).toChar()
|
||||
@@ -66,35 +66,40 @@ internal constructor(private val value: Int) : Comparable<Char> {
|
||||
@WasExperimental(ExperimentalStdlibApi::class)
|
||||
public operator fun rangeUntil(other: Char): CharRange = 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 fun toByte(): Byte = value.toByte()
|
||||
|
||||
/** Returns the value of this character as a `Char`. */
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun toChar(): 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 fun toShort(): Short = value.toShort()
|
||||
|
||||
/** Returns the value of this character as a `Int`. */
|
||||
@Deprecated("Conversion of Char to Number is deprecated. Use Char.code property instead.", ReplaceWith("this.code"))
|
||||
@DeprecatedSinceKotlin(warningSince = "1.5")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public fun toInt(): Int = value
|
||||
|
||||
/** 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 fun toLong(): Long = value.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 fun toFloat(): Float = value.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")
|
||||
@@ -102,20 +107,20 @@ internal constructor(private val value: Int) : Comparable<Char> {
|
||||
public fun toDouble(): Double = value.toDouble()
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
override fun equals(other: Any?): Boolean {
|
||||
@Suppress("JS_NAME_PROHIBITED_FOR_OVERRIDE")
|
||||
@JsName("toString")
|
||||
// TODO implicit usages of toString and valueOf must be covered in DCE
|
||||
public override fun toString(): String {
|
||||
return js("String").fromCharCode(value).unsafeCast<String>()
|
||||
}
|
||||
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun equals(other: Any?): Boolean {
|
||||
if (other !is Char) return false
|
||||
return this.value == other.value
|
||||
}
|
||||
|
||||
override fun hashCode(): Int = value
|
||||
|
||||
// TODO implicit usages of toString and valueOf must be covered in DCE
|
||||
@Suppress("JS_NAME_PROHIBITED_FOR_OVERRIDE")
|
||||
@JsName("toString")
|
||||
@kotlin.internal.IntrinsicConstEvaluation
|
||||
public override fun toString(): String {
|
||||
return js("String").fromCharCode(value).unsafeCast<String>()
|
||||
}
|
||||
public override fun hashCode(): Int = value
|
||||
|
||||
companion object {
|
||||
/**
|
||||
@@ -172,5 +177,4 @@ internal constructor(private val value: Int) : Comparable<Char> {
|
||||
@SinceKotlin("1.3")
|
||||
public const val SIZE_BITS: Int = 16
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user