[Generator] Generate Boolean class

This commit is contained in:
Ivan Kylchik
2023-07-21 15:17:17 +02:00
committed by Space Team
parent 3f3cd2e87a
commit 38e434bc07
11 changed files with 410 additions and 101 deletions
@@ -65,6 +65,8 @@ public final class Boolean : R|kotlin/Comparable<kotlin/Boolean>|, R|java/io/Ser
@R|kotlin/internal/IntrinsicConstEvaluation|() public open operator fun equals(other: R|kotlin/Any?|): R|kotlin/Boolean|
public open fun hashCode(): R|kotlin/Int|
@R|kotlin/internal/IntrinsicConstEvaluation|() public final operator fun not(): R|kotlin/Boolean|
@R|kotlin/internal/IntrinsicConstEvaluation|() public final infix fun or(other: R|kotlin/Boolean|): R|kotlin/Boolean|
+15 -26
View File
@@ -1,29 +1,21 @@
/*
* Copyright 2010-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* 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
/**
* Represents a value which is either `true` or `false`. On the JVM, non-nullable values of this type are
* represented as values of the primitive type `boolean`.
* Represents a value which is either `true` or `false`.
* On the JVM, non-nullable values of this type are represented as values of the primitive type `boolean`.
*/
public class Boolean private constructor() : Comparable<Boolean> {
/**
* Returns the inverse of this boolean.
*/
@SinceKotlin("1.3")
companion object {}
/** Returns the inverse of this boolean. */
@kotlin.internal.IntrinsicConstEvaluation
public operator fun not(): Boolean
@@ -41,21 +33,18 @@ public class Boolean private constructor() : Comparable<Boolean> {
@kotlin.internal.IntrinsicConstEvaluation
public infix fun or(other: Boolean): Boolean
/**
* Performs a logical `xor` operation between this Boolean and the [other] one.
*/
/** Performs a logical `xor` operation between this Boolean and the [other] one. */
@kotlin.internal.IntrinsicConstEvaluation
public infix fun xor(other: Boolean): Boolean
@kotlin.internal.IntrinsicConstEvaluation
public override fun compareTo(other: Boolean): Int
@kotlin.internal.IntrinsicConstEvaluation
public override fun equals(other: Any?): Boolean
@kotlin.internal.IntrinsicConstEvaluation
public override fun toString(): String
@SinceKotlin("1.3")
companion object {}
@kotlin.internal.IntrinsicConstEvaluation
public override fun equals(other: Any?): Boolean
public override fun hashCode(): Int
}
+12 -2
View File
@@ -18,6 +18,10 @@ import org.jetbrains.kotlin.generators.builtins.progressionIterators.GeneratePro
import org.jetbrains.kotlin.generators.builtins.progressions.GenerateProgressions
import org.jetbrains.kotlin.generators.builtins.ranges.GenerateRanges
import org.jetbrains.kotlin.generators.builtins.unsigned.generateUnsignedTypes
import primitives.JsBooleanGenerator
import primitives.JvmBooleanGenerator
import primitives.NativeBooleanGenerator
import primitives.WasmBooleanGenerator
import java.io.File
import java.io.PrintWriter
@@ -73,12 +77,18 @@ fun generateBuiltIns(generate: (File, (PrintWriter) -> BuiltInsGenerator) -> Uni
assertExists(RUNTIME_JVM_DIR)
assertExists(UNSIGNED_TYPES_DIR)
generate(File(RUNTIME_JVM_DIR, "kotlin/jvm/functions/Functions.kt")) { GenerateFunctions(it) }
generate(File(BUILT_INS_NATIVE_DIR_JVM, "kotlin/Arrays.kt")) { GenerateArrays(it) }
generate(File(BUILT_INS_NATIVE_DIR_JVM, "kotlin/Primitives.kt")) { JvmPrimitivesGenerator(it) }
generate(File(BUILT_INS_NATIVE_DIR_JS, "Primitives.kt")) { JsPrimitivesGenerator(it) }
generate(File(BUILT_INS_NATIVE_DIR_WASM, "kotlin/Primitives.kt")) { WasmPrimitivesGenerator(it) }
generate(File(BUILT_INS_NATIVE_DIR_NATIVE, "kotlin/Primitives.kt")) { NativePrimitivesGenerator(it) }
generate(File(BUILT_INS_NATIVE_DIR_JVM, "kotlin/Boolean.kt")) { JvmBooleanGenerator(it) }
generate(File(BUILT_INS_NATIVE_DIR_JS, "Boolean.kt")) { JsBooleanGenerator(it) }
generate(File(BUILT_INS_NATIVE_DIR_WASM, "kotlin/Boolean.kt")) { WasmBooleanGenerator(it) }
generate(File(BUILT_INS_NATIVE_DIR_NATIVE, "kotlin/Boolean.kt")) { NativeBooleanGenerator(it) }
generate(File(RUNTIME_JVM_DIR, "kotlin/jvm/functions/Functions.kt")) { GenerateFunctions(it) }
generate(File(BUILT_INS_NATIVE_DIR_JVM, "kotlin/Arrays.kt")) { GenerateArrays(it) }
generate(File(STDLIB_DIR, "kotlin/collections/PrimitiveIterators.kt")) { GenerateIterators(it) }
generate(File(RUNTIME_JVM_DIR, "kotlin/jvm/internal/ArrayIterators.kt")) { GenerateArrayIterators(it) }
generate(File(STDLIB_DIR, "kotlin/ranges/ProgressionIterators.kt")) { GenerateProgressionIterators(it) }
@@ -244,6 +244,8 @@ abstract class BasePrimitivesGenerator(private val writer: PrintWriter) : BuiltI
klass {
appendDoc("Represents a ${typeDescriptions[thisKind]}.")
name = className
superType("Number()")
superType("Comparable<$name>")
generateCompanionObject(thisKind)
generateCompareTo(thisKind)
@@ -0,0 +1,310 @@
/*
* 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.
*/
package primitives
import org.jetbrains.kotlin.generators.builtins.PrimitiveType
import org.jetbrains.kotlin.generators.builtins.generateBuiltIns.BuiltInsGenerator
import org.jetbrains.kotlin.generators.builtins.numbers.primitives.*
import org.jetbrains.kotlin.generators.builtins.numbers.primitives.NativePrimitivesGenerator.Companion.setAsExternal
import org.jetbrains.kotlin.generators.builtins.numbers.primitives.WasmPrimitivesGenerator.Companion.implementAsIntrinsic
import org.jetbrains.kotlin.generators.builtins.numbers.primitives.WasmPrimitivesGenerator.Companion.implementedAsIntrinsic
import java.io.PrintWriter
abstract class BooleanGenerator(private val writer: PrintWriter) : BuiltInsGenerator {
override fun generate() {
writer.print(generateFile().build())
}
private fun generateFile(): FileBuilder {
return file { generateClass() }.apply { this.modifyGeneratedFile() }
}
private fun FileBuilder.generateClass() {
klass {
appendDoc("Represents a value which is either `true` or `false`.")
name = PrimitiveType.BOOLEAN.capitalized
superType("Comparable<$name>")
generateCompanionObject()
generateNot()
generateAnd()
generateOr()
generateXor()
generateCompareTo()
generateToString()
generateEquals()
generateHashCode()
generateAdditionalMethods()
}.modifyGeneratedClass()
}
private fun ClassBuilder.generateCompanionObject() {
companionObject {
annotations += "SinceKotlin(\"1.3\")"
}.modifyGeneratedCompanionObject()
}
private fun ClassBuilder.generateNot() {
method {
appendDoc("Returns the inverse of this boolean.")
annotations += intrinsicConstEvaluationAnnotation
signature {
methodName = "not"
isOperator = true
returnType = PrimitiveType.BOOLEAN.capitalized
}
}.modifyGeneratedNot()
}
private fun ClassBuilder.generateBooleanMethod(giveMethodName: String, doc: String) = method {
appendDoc(doc)
annotations += intrinsicConstEvaluationAnnotation
signature {
methodName = giveMethodName
parameter {
name = "other"
type = PrimitiveType.BOOLEAN.capitalized
}
isInfix = true
returnType = PrimitiveType.BOOLEAN.capitalized
}
}
private fun ClassBuilder.generateAnd() {
val doc = """
Performs a logical `and` operation between this Boolean and the [other] one. Unlike the `&&` operator,
this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
""".trimIndent()
generateBooleanMethod("and", doc).modifyGeneratedAnd()
}
private fun ClassBuilder.generateOr() {
val doc = """
Performs a logical `or` operation between this Boolean and the [other] one. Unlike the `||` operator,
this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
""".trimIndent()
generateBooleanMethod("or", doc).modifyGeneratedOr()
}
private fun ClassBuilder.generateXor() {
val doc = "Performs a logical `xor` operation between this Boolean and the [other] one."
generateBooleanMethod("xor", doc).modifyGeneratedXor()
}
private fun ClassBuilder.generateCompareTo() {
method {
annotations += intrinsicConstEvaluationAnnotation
signature {
methodName = "compareTo"
parameter {
name = "other"
type = PrimitiveType.BOOLEAN.capitalized
}
isOverride = true
returnType = PrimitiveType.INT.capitalized
}
}.modifyGeneratedCompareTo()
}
private fun ClassBuilder.generateToString() {
method {
annotations += intrinsicConstEvaluationAnnotation
signature {
methodName = "toString"
isOverride = true
returnType = "String"
}
}.modifyGeneratedToString()
}
private fun ClassBuilder.generateEquals() {
method {
annotations += intrinsicConstEvaluationAnnotation
signature {
isOverride = true
methodName = "equals"
parameter {
name = "other"
type = "Any?"
}
returnType = PrimitiveType.BOOLEAN.capitalized
}
}.modifyGeneratedEquals()
}
private fun ClassBuilder.generateHashCode() {
method {
signature {
isOverride = true
methodName = "hashCode"
returnType = PrimitiveType.INT.capitalized
}
}.modifyGeneratedHashCode()
}
internal open fun FileBuilder.modifyGeneratedFile() {}
internal open fun ClassBuilder.modifyGeneratedClass() {}
internal open fun CompanionObjectBuilder.modifyGeneratedCompanionObject() {}
internal open fun MethodBuilder.modifyGeneratedNot() {}
internal open fun MethodBuilder.modifyGeneratedAnd() {}
internal open fun MethodBuilder.modifyGeneratedOr() {}
internal open fun MethodBuilder.modifyGeneratedXor() {}
internal open fun MethodBuilder.modifyGeneratedCompareTo() {}
internal open fun MethodBuilder.modifyGeneratedToString() {}
internal open fun MethodBuilder.modifyGeneratedEquals() {}
internal open fun MethodBuilder.modifyGeneratedHashCode() {}
internal open fun ClassBuilder.generateAdditionalMethods() {}
}
class JvmBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) {
override fun ClassBuilder.modifyGeneratedClass() {
appendDoc("On the JVM, non-nullable values of this type are represented as values of the primitive type `boolean`.")
}
}
class JsBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) {
override fun FileBuilder.modifyGeneratedFile() {
suppress("NON_ABSTRACT_FUNCTION_WITH_NO_BODY")
suppress("UNUSED_PARAMETER")
}
}
class WasmBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) {
override fun FileBuilder.modifyGeneratedFile() {
suppress("UNUSED_PARAMETER")
import("kotlin.wasm.internal.*")
}
override fun ClassBuilder.modifyGeneratedClass() {
annotations += "WasmAutoboxed"
constructorParam {
name = "private val value"
type = PrimitiveType.BOOLEAN.capitalized
}
}
override fun CompanionObjectBuilder.modifyGeneratedCompanionObject() {
isPublic = true
}
override fun MethodBuilder.modifyGeneratedNot() {
implementAsIntrinsic(PrimitiveType.BOOLEAN, methodName)
}
override fun MethodBuilder.modifyGeneratedAnd() {
implementAsIntrinsic(PrimitiveType.BOOLEAN, methodName)
}
override fun MethodBuilder.modifyGeneratedOr() {
implementAsIntrinsic(PrimitiveType.BOOLEAN, methodName)
}
override fun MethodBuilder.modifyGeneratedXor() {
implementAsIntrinsic(PrimitiveType.BOOLEAN, methodName)
}
override fun MethodBuilder.modifyGeneratedCompareTo() {
"wasm_i32_compareTo(this.toInt(), other.toInt())".addAsSingleLineBody(bodyOnNewLine = true)
}
override fun MethodBuilder.modifyGeneratedToString() {
modifySignature { visibility = null }
"if (this) \"true\" else \"false\"".addAsSingleLineBody(bodyOnNewLine = true)
}
override fun MethodBuilder.modifyGeneratedEquals() {
modifySignature { visibility = null }
"""
return if (other !is Boolean) {
false
} else {
wasm_i32_eq(this.toInt(), other.toInt())
}
""".trimIndent().addAsMultiLineBody()
}
override fun MethodBuilder.modifyGeneratedHashCode() {
modifySignature { visibility = null }
"if (this) 1231 else 1237".addAsSingleLineBody(bodyOnNewLine = true)
}
override fun ClassBuilder.generateAdditionalMethods() {
method {
annotations += "WasmNoOpCast"
signature {
visibility = MethodVisibility.INTERNAL
methodName = "toInt"
returnType = PrimitiveType.INT.capitalized
}
implementedAsIntrinsic.addAsSingleLineBody(bodyOnNewLine = true)
}
}
}
class NativeBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) {
override fun FileBuilder.modifyGeneratedFile() {
import("kotlin.native.internal.TypedIntrinsic")
import("kotlin.native.internal.IntrinsicType")
}
override fun MethodBuilder.modifyGeneratedNot() {
setAsExternal()
}
override fun MethodBuilder.modifyGeneratedAnd() {
setAsExternal()
}
override fun MethodBuilder.modifyGeneratedOr() {
setAsExternal()
}
override fun MethodBuilder.modifyGeneratedXor() {
setAsExternal()
}
override fun MethodBuilder.modifyGeneratedCompareTo() {
annotations += "TypedIntrinsic(IntrinsicType.UNSIGNED_COMPARE_TO)"
modifySignature { isExternal = true }
}
override fun MethodBuilder.modifyGeneratedToString() {
"if (this) \"true\" else \"false\"".addAsSingleLineBody()
}
override fun MethodBuilder.modifyGeneratedEquals() {
"other is Boolean && kotlin.native.internal.areEqualByValue(this, other)".addAsSingleLineBody(bodyOnNewLine = true)
}
private fun ClassBuilder.generateCustomEquals() {
method {
annotations += "Deprecated(\"Provided for binary compatibility\", level = DeprecationLevel.HIDDEN)"
annotations += intrinsicConstEvaluationAnnotation
signature {
methodName = "equals"
parameter {
name = "other"
type = PrimitiveType.BOOLEAN.capitalized
}
returnType = PrimitiveType.BOOLEAN.capitalized
}
"kotlin.native.internal.areEqualByValue(this, other)".addAsSingleLineBody(bodyOnNewLine = false)
}
}
override fun MethodBuilder.modifyGeneratedHashCode() {
modifySignature { visibility = MethodVisibility.PUBLIC }
"if (this) 1231 else 1237".addAsSingleLineBody(bodyOnNewLine = true)
}
override fun ClassBuilder.generateAdditionalMethods() {
generateCustomEquals()
}
}
@@ -241,7 +241,7 @@ class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(w
return this.uppercase(Locale.getDefault())
}
private fun MethodBuilder.setAsExternal() {
internal fun MethodBuilder.setAsExternal() {
annotations += "TypedIntrinsic(IntrinsicType.${methodName.toNativeOperator()})"
modifySignature { isExternal = true }
}
@@ -279,11 +279,13 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
methodName = "reinterpretAs${otherKind.capitalized}"
returnType = otherKind.capitalized
}
"implementedAsIntrinsic".addAsSingleLineBody(bodyOnNewLine = true)
implementedAsIntrinsic.addAsSingleLineBody(bodyOnNewLine = true)
}
}
companion object {
internal const val implementedAsIntrinsic = "implementedAsIntrinsic"
private fun String.toWasmOperator(): String {
return when (this) {
"plus" -> "ADD"
@@ -294,19 +296,20 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
"shr" -> "SHR_S"
"ushr" -> "SHR_U"
"equals" -> "EQ"
"not" -> "EQZ"
else -> this.uppercase()
}
}
private fun MethodBuilder.implementAsIntrinsic(thisKind: PrimitiveType, methodName: String) {
internal fun MethodBuilder.implementAsIntrinsic(thisKind: PrimitiveType, methodName: String) {
modifySignature { isInline = false }
annotations += "WasmOp(WasmOp.${thisKind.prefixUppercase}_${methodName.toWasmOperator()})"
"implementedAsIntrinsic".addAsSingleLineBody(bodyOnNewLine = true)
implementedAsIntrinsic.addAsSingleLineBody(bodyOnNewLine = true)
}
private val PrimitiveType.prefixUppercase: String
get() = when (this) {
PrimitiveType.BYTE, PrimitiveType.SHORT, PrimitiveType.INT -> "I32"
PrimitiveType.BYTE, PrimitiveType.SHORT, PrimitiveType.INT, PrimitiveType.BOOLEAN -> "I32"
PrimitiveType.LONG -> "I64"
PrimitiveType.FLOAT -> "F32"
PrimitiveType.DOUBLE -> "F64"
+15 -6
View File
@@ -122,6 +122,7 @@ internal class ClassBuilder : AnnotatedAndDocumented(), PrimitiveBuilder {
var isFinal: Boolean = false
var name: String = ""
private var constructorParam: MethodParameterBuilder? = null
private var superTypes: List<String> = emptyList()
private var companionObject: CompanionObjectBuilder? = null
private val methods: MutableList<MethodBuilder> = mutableListOf()
@@ -130,6 +131,10 @@ internal class ClassBuilder : AnnotatedAndDocumented(), PrimitiveBuilder {
constructorParam = MethodParameterBuilder().apply(init)
}
fun superType(type: String) {
superTypes += type
}
fun companionObject(init: CompanionObjectBuilder.() -> Unit): CompanionObjectBuilder {
throwIfAlreadyInitialized(companionObject, "companionObject", "ClassBuilder")
val companionObjectBuilder = CompanionObjectBuilder()
@@ -149,7 +154,7 @@ internal class ClassBuilder : AnnotatedAndDocumented(), PrimitiveBuilder {
append("public ")
if (isFinal) append("final ")
appendLine("class $name private constructor(${constructorParam?.build() ?: ""}) : Number(), Comparable<$name> {")
appendLine("class $name private constructor(${constructorParam?.build() ?: ""}) : ${superTypes.joinToString()} {")
companionObject?.let { appendLine(it.build().shift()) }
appendLine(methods.joinToString(separator = END_LINE + END_LINE) { it.build().shift() })
@@ -172,16 +177,20 @@ internal class CompanionObjectBuilder : AnnotatedAndDocumented(), PrimitiveBuild
return buildString {
printDocumentationAndAnnotations()
if (isPublic) append("public ")
appendLine("companion object {")
appendLine(properties.joinToString(separator = END_LINE + END_LINE) { it.build().shift() })
appendLine("}")
if (properties.isEmpty()) {
appendLine("companion object {}")
} else {
appendLine("companion object {")
appendLine(properties.joinToString(separator = END_LINE + END_LINE) { it.build().shift() })
appendLine("}")
}
}
}
}
internal class MethodSignatureBuilder : PrimitiveBuilder {
var isExternal: Boolean = false
var visibility: MethodVisibility = MethodVisibility.PUBLIC
var visibility: MethodVisibility? = MethodVisibility.PUBLIC
var isOverride: Boolean = false
var isInline: Boolean = false
var isInfix: Boolean = false
@@ -210,7 +219,7 @@ internal class MethodSignatureBuilder : PrimitiveBuilder {
return buildString {
if (isExternal) append("external ")
append("${visibility.name.lowercase()} ")
visibility?.let { append("${it.name.lowercase()} ") }
if (isOverride) append("override ")
if (isInline) append("inline ")
if (isInfix) append("infix ")
@@ -1,66 +1,61 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the LICENSE file.
* 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.native.internal.TypedIntrinsic
import kotlin.native.internal.IntrinsicType
/**
* Represents a value which is either `true` or `false`. On the JVM, non-nullable values of this type are
* represented as values of the primitive type `boolean`.
*/
/** Represents a value which is either `true` or `false`. */
public class Boolean private constructor() : Comparable<Boolean> {
@SinceKotlin("1.3")
companion object {}
/**
* Returns the inverse of this boolean.
*/
@TypedIntrinsic(IntrinsicType.NOT)
/** Returns the inverse of this boolean. */
@kotlin.internal.IntrinsicConstEvaluation
@TypedIntrinsic(IntrinsicType.NOT)
external public operator fun not(): Boolean
/**
* Performs a logical `and` operation between this Boolean and the [other] one. Unlike the `&&` operator,
* this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
*/
@TypedIntrinsic(IntrinsicType.AND)
@kotlin.internal.IntrinsicConstEvaluation
@TypedIntrinsic(IntrinsicType.AND)
external public infix fun and(other: Boolean): Boolean
/**
* Performs a logical `or` operation between this Boolean and the [other] one. Unlike the `||` operator,
* this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
*/
@TypedIntrinsic(IntrinsicType.OR)
@kotlin.internal.IntrinsicConstEvaluation
@TypedIntrinsic(IntrinsicType.OR)
external public infix fun or(other: Boolean): Boolean
/**
* Performs a logical `xor` operation between this Boolean and the [other] one.
*/
@TypedIntrinsic(IntrinsicType.XOR)
/** Performs a logical `xor` operation between this Boolean and the [other] one. */
@kotlin.internal.IntrinsicConstEvaluation
@TypedIntrinsic(IntrinsicType.XOR)
external public infix fun xor(other: Boolean): Boolean
@TypedIntrinsic(IntrinsicType.UNSIGNED_COMPARE_TO)
@kotlin.internal.IntrinsicConstEvaluation
@TypedIntrinsic(IntrinsicType.UNSIGNED_COMPARE_TO)
external public override fun compareTo(other: Boolean): Int
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
@kotlin.internal.IntrinsicConstEvaluation
public fun equals(other: Boolean): Boolean = kotlin.native.internal.areEqualByValue(this, other)
public override fun toString(): String = if (this) "true" else "false"
@kotlin.internal.IntrinsicConstEvaluation
public override fun equals(other: Any?): Boolean =
other is Boolean && kotlin.native.internal.areEqualByValue(this, other)
@kotlin.internal.IntrinsicConstEvaluation
public override fun toString() = if (this) "true" else "false"
public override fun hashCode(): Int =
if (this) 1231 else 1237
public override fun hashCode() = if (this) 1231 else 1237
}
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
@kotlin.internal.IntrinsicConstEvaluation
public fun equals(other: Boolean): Boolean = kotlin.native.internal.areEqualByValue(this, other)
}
+11 -17
View File
@@ -1,20 +1,20 @@
/*
* Copyright 2010-2019 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!
@file:Suppress("NON_ABSTRACT_FUNCTION_WITH_NO_BODY", "UNUSED_PARAMETER")
package kotlin
/**
* Represents a value which is either `true` or `false`. On the JVM, non-nullable values of this type are
* represented as values of the primitive type `boolean`.
*/
/** Represents a value which is either `true` or `false`. */
public class Boolean private constructor() : Comparable<Boolean> {
/**
* Returns the inverse of this boolean.
*/
@SinceKotlin("1.3")
companion object {}
/** Returns the inverse of this boolean. */
@kotlin.internal.IntrinsicConstEvaluation
public operator fun not(): Boolean
@@ -32,24 +32,18 @@ public class Boolean private constructor() : Comparable<Boolean> {
@kotlin.internal.IntrinsicConstEvaluation
public infix fun or(other: Boolean): Boolean
/**
* Performs a logical `xor` operation between this Boolean and the [other] one.
*/
/** Performs a logical `xor` operation between this Boolean and the [other] one. */
@kotlin.internal.IntrinsicConstEvaluation
public infix fun xor(other: Boolean): Boolean
@kotlin.internal.IntrinsicConstEvaluation
public override fun compareTo(other: Boolean): Int
@kotlin.internal.IntrinsicConstEvaluation
public override fun toString(): String
@kotlin.internal.IntrinsicConstEvaluation
public override fun equals(other: Any?): Boolean
public override fun hashCode(): Int
@kotlin.internal.IntrinsicConstEvaluation
public override fun toString(): String
@SinceKotlin("1.3")
companion object {}
}
@@ -1,25 +1,25 @@
/*
* Copyright 2010-2019 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!
@file:Suppress("UNUSED_PARAMETER")
package kotlin
import kotlin.wasm.internal.*
/**
* Represents a value which is either `true` or `false`. On the JVM, non-nullable values of this type are
* represented as values of the primitive type `boolean`.
*/
/** Represents a value which is either `true` or `false`. */
@WasmAutoboxed
public class Boolean private constructor(private val value: Boolean) : Comparable<Boolean> {
/**
* Returns the inverse of this boolean.
*/
@WasmOp(WasmOp.I32_EQZ)
@SinceKotlin("1.3")
public companion object {}
/** Returns the inverse of this boolean. */
@kotlin.internal.IntrinsicConstEvaluation
@WasmOp(WasmOp.I32_EQZ)
public operator fun not(): Boolean =
implementedAsIntrinsic
@@ -27,8 +27,8 @@ public class Boolean private constructor(private val value: Boolean) : Comparabl
* Performs a logical `and` operation between this Boolean and the [other] one. Unlike the `&&` operator,
* this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
*/
@WasmOp(WasmOp.I32_AND)
@kotlin.internal.IntrinsicConstEvaluation
@WasmOp(WasmOp.I32_AND)
public infix fun and(other: Boolean): Boolean =
implementedAsIntrinsic
@@ -36,16 +36,14 @@ public class Boolean private constructor(private val value: Boolean) : Comparabl
* Performs a logical `or` operation between this Boolean and the [other] one. Unlike the `||` operator,
* this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
*/
@WasmOp(WasmOp.I32_OR)
@kotlin.internal.IntrinsicConstEvaluation
@WasmOp(WasmOp.I32_OR)
public infix fun or(other: Boolean): Boolean =
implementedAsIntrinsic
/**
* Performs a logical `xor` operation between this Boolean and the [other] one.
*/
@WasmOp(WasmOp.I32_XOR)
/** Performs a logical `xor` operation between this Boolean and the [other] one. */
@kotlin.internal.IntrinsicConstEvaluation
@WasmOp(WasmOp.I32_XOR)
public infix fun xor(other: Boolean): Boolean =
implementedAsIntrinsic
@@ -57,9 +55,6 @@ public class Boolean private constructor(private val value: Boolean) : Comparabl
override fun toString(): String =
if (this) "true" else "false"
override fun hashCode(): Int =
if (this) 1231 else 1237
@kotlin.internal.IntrinsicConstEvaluation
override fun equals(other: Any?): Boolean {
return if (other !is Boolean) {
@@ -69,10 +64,10 @@ public class Boolean private constructor(private val value: Boolean) : Comparabl
}
}
override fun hashCode(): Int =
if (this) 1231 else 1237
@WasmNoOpCast
internal fun toInt(): Int =
implementedAsIntrinsic
@SinceKotlin("1.3")
public companion object
}