[Generator] Generate Boolean class
This commit is contained in:
@@ -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|
|
@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 operator fun not(): R|kotlin/Boolean|
|
||||||
|
|
||||||
@R|kotlin/internal/IntrinsicConstEvaluation|() public final infix fun or(other: R|kotlin/Boolean|): R|kotlin/Boolean|
|
@R|kotlin/internal/IntrinsicConstEvaluation|() public final infix fun or(other: R|kotlin/Boolean|): R|kotlin/Boolean|
|
||||||
|
|||||||
@@ -1,29 +1,21 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2015 JetBrains s.r.o.
|
* 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.
|
||||||
* 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Auto-generated file. DO NOT EDIT!
|
||||||
|
|
||||||
package kotlin
|
package kotlin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a value which is either `true` or `false`. On the JVM, non-nullable values of this type are
|
* Represents a value which is either `true` or `false`.
|
||||||
* represented as values of the primitive type `boolean`.
|
* 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> {
|
public class Boolean private constructor() : Comparable<Boolean> {
|
||||||
/**
|
@SinceKotlin("1.3")
|
||||||
* Returns the inverse of this boolean.
|
companion object {}
|
||||||
*/
|
|
||||||
|
/** Returns the inverse of this boolean. */
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
public operator fun not(): Boolean
|
public operator fun not(): Boolean
|
||||||
|
|
||||||
@@ -41,21 +33,18 @@ public class Boolean private constructor() : Comparable<Boolean> {
|
|||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
public infix fun or(other: Boolean): Boolean
|
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
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
public infix fun xor(other: Boolean): Boolean
|
public infix fun xor(other: Boolean): Boolean
|
||||||
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
public override fun compareTo(other: Boolean): Int
|
public override fun compareTo(other: Boolean): Int
|
||||||
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
|
||||||
public override fun equals(other: Any?): Boolean
|
|
||||||
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
public override fun toString(): String
|
public override fun toString(): String
|
||||||
|
|
||||||
@SinceKotlin("1.3")
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
companion object {}
|
public override fun equals(other: Any?): Boolean
|
||||||
|
|
||||||
|
public override fun hashCode(): Int
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.progressions.GenerateProgressions
|
||||||
import org.jetbrains.kotlin.generators.builtins.ranges.GenerateRanges
|
import org.jetbrains.kotlin.generators.builtins.ranges.GenerateRanges
|
||||||
import org.jetbrains.kotlin.generators.builtins.unsigned.generateUnsignedTypes
|
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.File
|
||||||
import java.io.PrintWriter
|
import java.io.PrintWriter
|
||||||
|
|
||||||
@@ -73,12 +77,18 @@ fun generateBuiltIns(generate: (File, (PrintWriter) -> BuiltInsGenerator) -> Uni
|
|||||||
assertExists(RUNTIME_JVM_DIR)
|
assertExists(RUNTIME_JVM_DIR)
|
||||||
assertExists(UNSIGNED_TYPES_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_JVM, "kotlin/Primitives.kt")) { JvmPrimitivesGenerator(it) }
|
||||||
generate(File(BUILT_INS_NATIVE_DIR_JS, "Primitives.kt")) { JsPrimitivesGenerator(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_WASM, "kotlin/Primitives.kt")) { WasmPrimitivesGenerator(it) }
|
||||||
generate(File(BUILT_INS_NATIVE_DIR_NATIVE, "kotlin/Primitives.kt")) { NativePrimitivesGenerator(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(STDLIB_DIR, "kotlin/collections/PrimitiveIterators.kt")) { GenerateIterators(it) }
|
||||||
generate(File(RUNTIME_JVM_DIR, "kotlin/jvm/internal/ArrayIterators.kt")) { GenerateArrayIterators(it) }
|
generate(File(RUNTIME_JVM_DIR, "kotlin/jvm/internal/ArrayIterators.kt")) { GenerateArrayIterators(it) }
|
||||||
generate(File(STDLIB_DIR, "kotlin/ranges/ProgressionIterators.kt")) { GenerateProgressionIterators(it) }
|
generate(File(STDLIB_DIR, "kotlin/ranges/ProgressionIterators.kt")) { GenerateProgressionIterators(it) }
|
||||||
|
|||||||
@@ -244,6 +244,8 @@ abstract class BasePrimitivesGenerator(private val writer: PrintWriter) : BuiltI
|
|||||||
klass {
|
klass {
|
||||||
appendDoc("Represents a ${typeDescriptions[thisKind]}.")
|
appendDoc("Represents a ${typeDescriptions[thisKind]}.")
|
||||||
name = className
|
name = className
|
||||||
|
superType("Number()")
|
||||||
|
superType("Comparable<$name>")
|
||||||
generateCompanionObject(thisKind)
|
generateCompanionObject(thisKind)
|
||||||
|
|
||||||
generateCompareTo(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())
|
return this.uppercase(Locale.getDefault())
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun MethodBuilder.setAsExternal() {
|
internal fun MethodBuilder.setAsExternal() {
|
||||||
annotations += "TypedIntrinsic(IntrinsicType.${methodName.toNativeOperator()})"
|
annotations += "TypedIntrinsic(IntrinsicType.${methodName.toNativeOperator()})"
|
||||||
modifySignature { isExternal = true }
|
modifySignature { isExternal = true }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,11 +279,13 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
|||||||
methodName = "reinterpretAs${otherKind.capitalized}"
|
methodName = "reinterpretAs${otherKind.capitalized}"
|
||||||
returnType = otherKind.capitalized
|
returnType = otherKind.capitalized
|
||||||
}
|
}
|
||||||
"implementedAsIntrinsic".addAsSingleLineBody(bodyOnNewLine = true)
|
implementedAsIntrinsic.addAsSingleLineBody(bodyOnNewLine = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
internal const val implementedAsIntrinsic = "implementedAsIntrinsic"
|
||||||
|
|
||||||
private fun String.toWasmOperator(): String {
|
private fun String.toWasmOperator(): String {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
"plus" -> "ADD"
|
"plus" -> "ADD"
|
||||||
@@ -294,19 +296,20 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri
|
|||||||
"shr" -> "SHR_S"
|
"shr" -> "SHR_S"
|
||||||
"ushr" -> "SHR_U"
|
"ushr" -> "SHR_U"
|
||||||
"equals" -> "EQ"
|
"equals" -> "EQ"
|
||||||
|
"not" -> "EQZ"
|
||||||
else -> this.uppercase()
|
else -> this.uppercase()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun MethodBuilder.implementAsIntrinsic(thisKind: PrimitiveType, methodName: String) {
|
internal fun MethodBuilder.implementAsIntrinsic(thisKind: PrimitiveType, methodName: String) {
|
||||||
modifySignature { isInline = false }
|
modifySignature { isInline = false }
|
||||||
annotations += "WasmOp(WasmOp.${thisKind.prefixUppercase}_${methodName.toWasmOperator()})"
|
annotations += "WasmOp(WasmOp.${thisKind.prefixUppercase}_${methodName.toWasmOperator()})"
|
||||||
"implementedAsIntrinsic".addAsSingleLineBody(bodyOnNewLine = true)
|
implementedAsIntrinsic.addAsSingleLineBody(bodyOnNewLine = true)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val PrimitiveType.prefixUppercase: String
|
private val PrimitiveType.prefixUppercase: String
|
||||||
get() = when (this) {
|
get() = when (this) {
|
||||||
PrimitiveType.BYTE, PrimitiveType.SHORT, PrimitiveType.INT -> "I32"
|
PrimitiveType.BYTE, PrimitiveType.SHORT, PrimitiveType.INT, PrimitiveType.BOOLEAN -> "I32"
|
||||||
PrimitiveType.LONG -> "I64"
|
PrimitiveType.LONG -> "I64"
|
||||||
PrimitiveType.FLOAT -> "F32"
|
PrimitiveType.FLOAT -> "F32"
|
||||||
PrimitiveType.DOUBLE -> "F64"
|
PrimitiveType.DOUBLE -> "F64"
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ internal class ClassBuilder : AnnotatedAndDocumented(), PrimitiveBuilder {
|
|||||||
var isFinal: Boolean = false
|
var isFinal: Boolean = false
|
||||||
var name: String = ""
|
var name: String = ""
|
||||||
private var constructorParam: MethodParameterBuilder? = null
|
private var constructorParam: MethodParameterBuilder? = null
|
||||||
|
private var superTypes: List<String> = emptyList()
|
||||||
private var companionObject: CompanionObjectBuilder? = null
|
private var companionObject: CompanionObjectBuilder? = null
|
||||||
private val methods: MutableList<MethodBuilder> = mutableListOf()
|
private val methods: MutableList<MethodBuilder> = mutableListOf()
|
||||||
|
|
||||||
@@ -130,6 +131,10 @@ internal class ClassBuilder : AnnotatedAndDocumented(), PrimitiveBuilder {
|
|||||||
constructorParam = MethodParameterBuilder().apply(init)
|
constructorParam = MethodParameterBuilder().apply(init)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun superType(type: String) {
|
||||||
|
superTypes += type
|
||||||
|
}
|
||||||
|
|
||||||
fun companionObject(init: CompanionObjectBuilder.() -> Unit): CompanionObjectBuilder {
|
fun companionObject(init: CompanionObjectBuilder.() -> Unit): CompanionObjectBuilder {
|
||||||
throwIfAlreadyInitialized(companionObject, "companionObject", "ClassBuilder")
|
throwIfAlreadyInitialized(companionObject, "companionObject", "ClassBuilder")
|
||||||
val companionObjectBuilder = CompanionObjectBuilder()
|
val companionObjectBuilder = CompanionObjectBuilder()
|
||||||
@@ -149,7 +154,7 @@ internal class ClassBuilder : AnnotatedAndDocumented(), PrimitiveBuilder {
|
|||||||
|
|
||||||
append("public ")
|
append("public ")
|
||||||
if (isFinal) append("final ")
|
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()) }
|
companionObject?.let { appendLine(it.build().shift()) }
|
||||||
appendLine(methods.joinToString(separator = END_LINE + END_LINE) { 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 {
|
return buildString {
|
||||||
printDocumentationAndAnnotations()
|
printDocumentationAndAnnotations()
|
||||||
if (isPublic) append("public ")
|
if (isPublic) append("public ")
|
||||||
appendLine("companion object {")
|
if (properties.isEmpty()) {
|
||||||
appendLine(properties.joinToString(separator = END_LINE + END_LINE) { it.build().shift() })
|
appendLine("companion object {}")
|
||||||
appendLine("}")
|
} else {
|
||||||
|
appendLine("companion object {")
|
||||||
|
appendLine(properties.joinToString(separator = END_LINE + END_LINE) { it.build().shift() })
|
||||||
|
appendLine("}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class MethodSignatureBuilder : PrimitiveBuilder {
|
internal class MethodSignatureBuilder : PrimitiveBuilder {
|
||||||
var isExternal: Boolean = false
|
var isExternal: Boolean = false
|
||||||
var visibility: MethodVisibility = MethodVisibility.PUBLIC
|
var visibility: MethodVisibility? = MethodVisibility.PUBLIC
|
||||||
var isOverride: Boolean = false
|
var isOverride: Boolean = false
|
||||||
var isInline: Boolean = false
|
var isInline: Boolean = false
|
||||||
var isInfix: Boolean = false
|
var isInfix: Boolean = false
|
||||||
@@ -210,7 +219,7 @@ internal class MethodSignatureBuilder : PrimitiveBuilder {
|
|||||||
|
|
||||||
return buildString {
|
return buildString {
|
||||||
if (isExternal) append("external ")
|
if (isExternal) append("external ")
|
||||||
append("${visibility.name.lowercase()} ")
|
visibility?.let { append("${it.name.lowercase()} ") }
|
||||||
if (isOverride) append("override ")
|
if (isOverride) append("override ")
|
||||||
if (isInline) append("inline ")
|
if (isInline) append("inline ")
|
||||||
if (isInfix) append("infix ")
|
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
|
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* that can be found in the LICENSE file.
|
* 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
|
package kotlin
|
||||||
|
|
||||||
import kotlin.native.internal.TypedIntrinsic
|
import kotlin.native.internal.TypedIntrinsic
|
||||||
import kotlin.native.internal.IntrinsicType
|
import kotlin.native.internal.IntrinsicType
|
||||||
|
|
||||||
/**
|
/** Represents a value which is either `true` or `false`. */
|
||||||
* 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> {
|
public class Boolean private constructor() : Comparable<Boolean> {
|
||||||
|
|
||||||
@SinceKotlin("1.3")
|
@SinceKotlin("1.3")
|
||||||
companion object {}
|
companion object {}
|
||||||
|
|
||||||
/**
|
/** Returns the inverse of this boolean. */
|
||||||
* Returns the inverse of this boolean.
|
|
||||||
*/
|
|
||||||
@TypedIntrinsic(IntrinsicType.NOT)
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
|
@TypedIntrinsic(IntrinsicType.NOT)
|
||||||
external public operator fun not(): Boolean
|
external public operator fun not(): Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a logical `and` operation between this Boolean and the [other] one. Unlike the `&&` operator,
|
* 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.
|
* this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
|
||||||
*/
|
*/
|
||||||
@TypedIntrinsic(IntrinsicType.AND)
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
|
@TypedIntrinsic(IntrinsicType.AND)
|
||||||
external public infix fun and(other: Boolean): Boolean
|
external public infix fun and(other: Boolean): Boolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a logical `or` operation between this Boolean and the [other] one. Unlike the `||` operator,
|
* 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.
|
* this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
|
||||||
*/
|
*/
|
||||||
@TypedIntrinsic(IntrinsicType.OR)
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
|
@TypedIntrinsic(IntrinsicType.OR)
|
||||||
external public infix fun or(other: Boolean): Boolean
|
external 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.
|
|
||||||
*/
|
|
||||||
@TypedIntrinsic(IntrinsicType.XOR)
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
|
@TypedIntrinsic(IntrinsicType.XOR)
|
||||||
external public infix fun xor(other: Boolean): Boolean
|
external public infix fun xor(other: Boolean): Boolean
|
||||||
|
|
||||||
@TypedIntrinsic(IntrinsicType.UNSIGNED_COMPARE_TO)
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
|
@TypedIntrinsic(IntrinsicType.UNSIGNED_COMPARE_TO)
|
||||||
external public override fun compareTo(other: Boolean): Int
|
external public override fun compareTo(other: Boolean): Int
|
||||||
|
|
||||||
@Deprecated("Provided for binary compatibility", level = DeprecationLevel.HIDDEN)
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@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
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
public override fun equals(other: Any?): Boolean =
|
public override fun equals(other: Any?): Boolean =
|
||||||
other is Boolean && kotlin.native.internal.areEqualByValue(this, other)
|
other is Boolean && kotlin.native.internal.areEqualByValue(this, other)
|
||||||
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
public override fun hashCode(): Int =
|
||||||
public override fun toString() = if (this) "true" else "false"
|
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)
|
||||||
}
|
}
|
||||||
@@ -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.
|
* 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")
|
@file:Suppress("NON_ABSTRACT_FUNCTION_WITH_NO_BODY", "UNUSED_PARAMETER")
|
||||||
|
|
||||||
package kotlin
|
package kotlin
|
||||||
|
|
||||||
/**
|
/** Represents a value which is either `true` or `false`. */
|
||||||
* 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> {
|
public class Boolean private constructor() : Comparable<Boolean> {
|
||||||
/**
|
@SinceKotlin("1.3")
|
||||||
* Returns the inverse of this boolean.
|
companion object {}
|
||||||
*/
|
|
||||||
|
/** Returns the inverse of this boolean. */
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
public operator fun not(): Boolean
|
public operator fun not(): Boolean
|
||||||
|
|
||||||
@@ -32,24 +32,18 @@ public class Boolean private constructor() : Comparable<Boolean> {
|
|||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
public infix fun or(other: Boolean): Boolean
|
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
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
public infix fun xor(other: Boolean): Boolean
|
public infix fun xor(other: Boolean): Boolean
|
||||||
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
public override fun compareTo(other: Boolean): Int
|
public override fun compareTo(other: Boolean): Int
|
||||||
|
|
||||||
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
|
public override fun toString(): String
|
||||||
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
public override fun equals(other: Any?): Boolean
|
public override fun equals(other: Any?): Boolean
|
||||||
|
|
||||||
public override fun hashCode(): Int
|
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.
|
* 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")
|
@file:Suppress("UNUSED_PARAMETER")
|
||||||
|
|
||||||
package kotlin
|
package kotlin
|
||||||
|
|
||||||
import kotlin.wasm.internal.*
|
import kotlin.wasm.internal.*
|
||||||
|
|
||||||
/**
|
/** Represents a value which is either `true` or `false`. */
|
||||||
* 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`.
|
|
||||||
*/
|
|
||||||
@WasmAutoboxed
|
@WasmAutoboxed
|
||||||
public class Boolean private constructor(private val value: Boolean) : Comparable<Boolean> {
|
public class Boolean private constructor(private val value: Boolean) : Comparable<Boolean> {
|
||||||
/**
|
@SinceKotlin("1.3")
|
||||||
* Returns the inverse of this boolean.
|
public companion object {}
|
||||||
*/
|
|
||||||
@WasmOp(WasmOp.I32_EQZ)
|
/** Returns the inverse of this boolean. */
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
|
@WasmOp(WasmOp.I32_EQZ)
|
||||||
public operator fun not(): Boolean =
|
public operator fun not(): Boolean =
|
||||||
implementedAsIntrinsic
|
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,
|
* 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.
|
* this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
|
||||||
*/
|
*/
|
||||||
@WasmOp(WasmOp.I32_AND)
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
|
@WasmOp(WasmOp.I32_AND)
|
||||||
public infix fun and(other: Boolean): Boolean =
|
public infix fun and(other: Boolean): Boolean =
|
||||||
implementedAsIntrinsic
|
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,
|
* 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.
|
* this function does not perform short-circuit evaluation. Both `this` and [other] will always be evaluated.
|
||||||
*/
|
*/
|
||||||
@WasmOp(WasmOp.I32_OR)
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
|
@WasmOp(WasmOp.I32_OR)
|
||||||
public infix fun or(other: Boolean): Boolean =
|
public infix fun or(other: Boolean): Boolean =
|
||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
|
|
||||||
/**
|
/** Performs a logical `xor` operation between this Boolean and the [other] one. */
|
||||||
* Performs a logical `xor` operation between this Boolean and the [other] one.
|
|
||||||
*/
|
|
||||||
@WasmOp(WasmOp.I32_XOR)
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
|
@WasmOp(WasmOp.I32_XOR)
|
||||||
public infix fun xor(other: Boolean): Boolean =
|
public infix fun xor(other: Boolean): Boolean =
|
||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
|
|
||||||
@@ -57,9 +55,6 @@ public class Boolean private constructor(private val value: Boolean) : Comparabl
|
|||||||
override fun toString(): String =
|
override fun toString(): String =
|
||||||
if (this) "true" else "false"
|
if (this) "true" else "false"
|
||||||
|
|
||||||
override fun hashCode(): Int =
|
|
||||||
if (this) 1231 else 1237
|
|
||||||
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
return if (other !is 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
|
@WasmNoOpCast
|
||||||
internal fun toInt(): Int =
|
internal fun toInt(): Int =
|
||||||
implementedAsIntrinsic
|
implementedAsIntrinsic
|
||||||
|
|
||||||
@SinceKotlin("1.3")
|
|
||||||
public companion object
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user