[Generator] Do not omit public visibility of methods in wasm
This commit is contained in:
committed by
Space Team
parent
918b935e22
commit
8ae21c0e1b
@@ -224,12 +224,10 @@ class WasmBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun MethodBuilder.modifyGeneratedToString() {
|
override fun MethodBuilder.modifyGeneratedToString() {
|
||||||
modifySignature { visibility = null }
|
|
||||||
"if (this) \"true\" else \"false\"".setAsExpressionBody()
|
"if (this) \"true\" else \"false\"".setAsExpressionBody()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun MethodBuilder.modifyGeneratedEquals() {
|
override fun MethodBuilder.modifyGeneratedEquals() {
|
||||||
modifySignature { visibility = null }
|
|
||||||
"""
|
"""
|
||||||
return if (other !is Boolean) {
|
return if (other !is Boolean) {
|
||||||
false
|
false
|
||||||
@@ -239,10 +237,6 @@ class WasmBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) {
|
|||||||
""".trimIndent().setAsBlockBody()
|
""".trimIndent().setAsBlockBody()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun MethodBuilder.modifyGeneratedHashCode() {
|
|
||||||
modifySignature { visibility = null }
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun ClassBuilder.generateAdditionalMethods() {
|
override fun ClassBuilder.generateAdditionalMethods() {
|
||||||
method {
|
method {
|
||||||
annotations += "WasmNoOpCast"
|
annotations += "WasmNoOpCast"
|
||||||
@@ -307,10 +301,6 @@ class NativeBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun MethodBuilder.modifyGeneratedHashCode() {
|
|
||||||
modifySignature { visibility = MethodVisibility.PUBLIC }
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun ClassBuilder.generateAdditionalMethods() {
|
override fun ClassBuilder.generateAdditionalMethods() {
|
||||||
generateCustomEquals()
|
generateCustomEquals()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -547,7 +547,6 @@ class WasmCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun MethodBuilder.modifyGeneratedToString() {
|
override fun MethodBuilder.modifyGeneratedToString() {
|
||||||
modifySignature { visibility = null }
|
|
||||||
"""
|
"""
|
||||||
val array = WasmCharArray(1)
|
val array = WasmCharArray(1)
|
||||||
array.set(0, this)
|
array.set(0, this)
|
||||||
@@ -556,7 +555,6 @@ class WasmCharGenerator(writer: PrintWriter) : CharGenerator(writer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun MethodBuilder.modifyGeneratedHashCode() {
|
override fun MethodBuilder.modifyGeneratedHashCode() {
|
||||||
modifySignature { visibility = null }
|
|
||||||
"this.code.hashCode()".setAsExpressionBody()
|
"this.code.hashCode()".setAsExpressionBody()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ internal class SecondaryConstructorBuilder : AnnotatedAndDocumented(), Primitive
|
|||||||
|
|
||||||
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
|
||||||
@@ -293,7 +293,7 @@ internal class MethodSignatureBuilder : PrimitiveBuilder {
|
|||||||
throwIfWasNotInitialized(returnType, "returnType", "MethodSignatureBuilder")
|
throwIfWasNotInitialized(returnType, "returnType", "MethodSignatureBuilder")
|
||||||
|
|
||||||
return buildString {
|
return buildString {
|
||||||
visibility?.let { append("${it.name.lowercase()} ") }
|
append("${visibility.name.lowercase()} ")
|
||||||
if (isExternal) append("external ")
|
if (isExternal) append("external ")
|
||||||
if (isOverride) append("override ")
|
if (isOverride) append("override ")
|
||||||
if (isInline) append("inline ")
|
if (isInline) append("inline ")
|
||||||
|
|||||||
@@ -53,11 +53,11 @@ public class Boolean private constructor(private val value: Boolean) : Comparabl
|
|||||||
wasm_i32_compareTo(this.toInt(), other.toInt())
|
wasm_i32_compareTo(this.toInt(), other.toInt())
|
||||||
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
override fun toString(): String =
|
public override fun toString(): String =
|
||||||
if (this) "true" else "false"
|
if (this) "true" else "false"
|
||||||
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
override fun equals(other: Any?): Boolean {
|
public override fun equals(other: Any?): Boolean {
|
||||||
return if (other !is Boolean) {
|
return if (other !is Boolean) {
|
||||||
false
|
false
|
||||||
} else {
|
} else {
|
||||||
@@ -65,7 +65,7 @@ public class Boolean private constructor(private val value: Boolean) : Comparabl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int =
|
public override fun hashCode(): Int =
|
||||||
if (this) 1231 else 1237
|
if (this) 1231 else 1237
|
||||||
|
|
||||||
@WasmNoOpCast
|
@WasmNoOpCast
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public class Char private constructor(private val value: Char) : Comparable<Char
|
|||||||
this.code.toDouble()
|
this.code.toDouble()
|
||||||
|
|
||||||
@kotlin.internal.IntrinsicConstEvaluation
|
@kotlin.internal.IntrinsicConstEvaluation
|
||||||
override fun toString(): String {
|
public override fun toString(): String {
|
||||||
val array = WasmCharArray(1)
|
val array = WasmCharArray(1)
|
||||||
array.set(0, this)
|
array.set(0, this)
|
||||||
return array.createString()
|
return array.createString()
|
||||||
@@ -131,7 +131,7 @@ public class Char private constructor(private val value: Char) : Comparable<Char
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int =
|
public override fun hashCode(): Int =
|
||||||
this.code.hashCode()
|
this.code.hashCode()
|
||||||
|
|
||||||
public companion object {
|
public companion object {
|
||||||
|
|||||||
Reference in New Issue
Block a user