Rename unary plus/minus in builtins and stdlib
This commit is contained in:
@@ -31,8 +31,8 @@ class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
private val unaryOperators: Map<String, String> = mapOf(
|
||||
"inc" to "Increments this value.",
|
||||
"dec" to "Decrements this value.",
|
||||
"plus" to "Returns this value.",
|
||||
"minus" to "Returns the negative of this value.")
|
||||
"unaryPlus" to "Returns this value.",
|
||||
"unaryMinus" to "Returns the negative of this value.")
|
||||
private val shiftOperators: Map<String, String> = mapOf(
|
||||
"shl" to "Shifts this value left by [bits].",
|
||||
"shr" to "Shifts this value right by [bits], filling the leftmost bits with copies of the sign bit.",
|
||||
@@ -131,7 +131,7 @@ class GeneratePrimitives(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
private fun generateUnaryOperators(kind: PrimitiveType) {
|
||||
for ((name, doc) in unaryOperators) {
|
||||
val returnType = if (kind in listOf(PrimitiveType.SHORT, PrimitiveType.BYTE, PrimitiveType.CHAR) &&
|
||||
name in listOf("plus", "minus")) "Int" else kind.capitalized
|
||||
name in listOf("unaryPlus", "unaryMinus")) "Int" else kind.capitalized
|
||||
out.println(" /** $doc */")
|
||||
out.println(" public operator fun $name(): $returnType")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user