fun evalUnaryOp()

in compiler/frontend.common/src/org/jetbrains/kotlin/resolve/constants/evaluate/OperationsMapGenerated.kt [14:190]


fun evalUnaryOp(name: String, type: CompileTimeType, value: Any): Any? {
    when (type) {
        BOOLEAN -> when (name) {
            "not" -> return (value as Boolean).not()
            "toString" -> return (value as Boolean).toString()
        }
        BYTE -> when (name) {
            "toByte" -> return (value as Byte).toByte()
            "toChar" -> return (value as Byte).toChar()
            "toDouble" -> return (value as Byte).toDouble()
            "toFloat" -> return (value as Byte).toFloat()
            "toInt" -> return (value as Byte).toInt()
            "toLong" -> return (value as Byte).toLong()
            "toShort" -> return (value as Byte).toShort()
            "toString" -> return (value as Byte).toString()
            "unaryMinus" -> return (value as Byte).unaryMinus()
            "unaryPlus" -> return (value as Byte).unaryPlus()
            "toULong" -> return (value as Byte).toULong()
            "toUInt" -> return (value as Byte).toUInt()
            "toUShort" -> return (value as Byte).toUShort()
            "toUByte" -> return (value as Byte).toUByte()
        }
        CHAR -> when (name) {
            "toByte" -> return (value as Char).toByte()
            "toChar" -> return (value as Char).toChar()
            "toDouble" -> return (value as Char).toDouble()
            "toFloat" -> return (value as Char).toFloat()
            "toInt" -> return (value as Char).toInt()
            "toLong" -> return (value as Char).toLong()
            "toShort" -> return (value as Char).toShort()
            "toString" -> return (value as Char).toString()
            "code" -> return (value as Char).code
        }
        DOUBLE -> when (name) {
            "toByte" -> return (value as Double).toByte()
            "toChar" -> return (value as Double).toChar()
            "toDouble" -> return (value as Double).toDouble()
            "toFloat" -> return (value as Double).toFloat()
            "toInt" -> return (value as Double).toInt()
            "toLong" -> return (value as Double).toLong()
            "toShort" -> return (value as Double).toShort()
            "toString" -> return (value as Double).toString()
            "unaryMinus" -> return (value as Double).unaryMinus()
            "unaryPlus" -> return (value as Double).unaryPlus()
            "toULong" -> return (value as Double).toULong()
            "toUInt" -> return (value as Double).toUInt()
        }
        FLOAT -> when (name) {
            "toByte" -> return (value as Float).toByte()
            "toChar" -> return (value as Float).toChar()
            "toDouble" -> return (value as Float).toDouble()
            "toFloat" -> return (value as Float).toFloat()
            "toInt" -> return (value as Float).toInt()
            "toLong" -> return (value as Float).toLong()
            "toShort" -> return (value as Float).toShort()
            "toString" -> return (value as Float).toString()
            "unaryMinus" -> return (value as Float).unaryMinus()
            "unaryPlus" -> return (value as Float).unaryPlus()
            "toULong" -> return (value as Float).toULong()
            "toUInt" -> return (value as Float).toUInt()
        }
        INT -> when (name) {
            "inv" -> return (value as Int).inv()
            "toByte" -> return (value as Int).toByte()
            "toChar" -> return (value as Int).toChar()
            "toDouble" -> return (value as Int).toDouble()
            "toFloat" -> return (value as Int).toFloat()
            "toInt" -> return (value as Int).toInt()
            "toLong" -> return (value as Int).toLong()
            "toShort" -> return (value as Int).toShort()
            "toString" -> return (value as Int).toString()
            "unaryMinus" -> return (value as Int).unaryMinus()
            "unaryPlus" -> return (value as Int).unaryPlus()
            "toULong" -> return (value as Int).toULong()
            "toUInt" -> return (value as Int).toUInt()
            "toUShort" -> return (value as Int).toUShort()
            "toUByte" -> return (value as Int).toUByte()
        }
        LONG -> when (name) {
            "inv" -> return (value as Long).inv()
            "toByte" -> return (value as Long).toByte()
            "toChar" -> return (value as Long).toChar()
            "toDouble" -> return (value as Long).toDouble()
            "toFloat" -> return (value as Long).toFloat()
            "toInt" -> return (value as Long).toInt()
            "toLong" -> return (value as Long).toLong()
            "toShort" -> return (value as Long).toShort()
            "toString" -> return (value as Long).toString()
            "unaryMinus" -> return (value as Long).unaryMinus()
            "unaryPlus" -> return (value as Long).unaryPlus()
            "toULong" -> return (value as Long).toULong()
            "toUInt" -> return (value as Long).toUInt()
            "toUShort" -> return (value as Long).toUShort()
            "toUByte" -> return (value as Long).toUByte()
        }
        SHORT -> when (name) {
            "toByte" -> return (value as Short).toByte()
            "toChar" -> return (value as Short).toChar()
            "toDouble" -> return (value as Short).toDouble()
            "toFloat" -> return (value as Short).toFloat()
            "toInt" -> return (value as Short).toInt()
            "toLong" -> return (value as Short).toLong()
            "toShort" -> return (value as Short).toShort()
            "toString" -> return (value as Short).toString()
            "unaryMinus" -> return (value as Short).unaryMinus()
            "unaryPlus" -> return (value as Short).unaryPlus()
            "toULong" -> return (value as Short).toULong()
            "toUInt" -> return (value as Short).toUInt()
            "toUShort" -> return (value as Short).toUShort()
            "toUByte" -> return (value as Short).toUByte()
        }
        STRING -> when (name) {
            "length" -> return (value as String).length
            "toString" -> return (value as String).toString()
            "trimIndent" -> return (value as String).trimIndent()
            "trimMargin" -> return (value as String).trimMargin()
        }
        UINT -> when (name) {
            "inv" -> return (value as UInt).inv()
            "toByte" -> return (value as UInt).toByte()
            "toDouble" -> return (value as UInt).toDouble()
            "toFloat" -> return (value as UInt).toFloat()
            "toInt" -> return (value as UInt).toInt()
            "toLong" -> return (value as UInt).toLong()
            "toShort" -> return (value as UInt).toShort()
            "toString" -> return (value as UInt).toString()
            "toUByte" -> return (value as UInt).toUByte()
            "toUInt" -> return (value as UInt).toUInt()
            "toULong" -> return (value as UInt).toULong()
            "toUShort" -> return (value as UInt).toUShort()
        }
        ULONG -> when (name) {
            "inv" -> return (value as ULong).inv()
            "toByte" -> return (value as ULong).toByte()
            "toDouble" -> return (value as ULong).toDouble()
            "toFloat" -> return (value as ULong).toFloat()
            "toInt" -> return (value as ULong).toInt()
            "toLong" -> return (value as ULong).toLong()
            "toShort" -> return (value as ULong).toShort()
            "toString" -> return (value as ULong).toString()
            "toUByte" -> return (value as ULong).toUByte()
            "toUInt" -> return (value as ULong).toUInt()
            "toULong" -> return (value as ULong).toULong()
            "toUShort" -> return (value as ULong).toUShort()
        }
        UBYTE -> when (name) {
            "inv" -> return (value as UByte).inv()
            "toByte" -> return (value as UByte).toByte()
            "toDouble" -> return (value as UByte).toDouble()
            "toFloat" -> return (value as UByte).toFloat()
            "toInt" -> return (value as UByte).toInt()
            "toLong" -> return (value as UByte).toLong()
            "toShort" -> return (value as UByte).toShort()
            "toString" -> return (value as UByte).toString()
            "toUByte" -> return (value as UByte).toUByte()
            "toUInt" -> return (value as UByte).toUInt()
            "toULong" -> return (value as UByte).toULong()
            "toUShort" -> return (value as UByte).toUShort()
        }
        USHORT -> when (name) {
            "inv" -> return (value as UShort).inv()
            "toByte" -> return (value as UShort).toByte()
            "toDouble" -> return (value as UShort).toDouble()
            "toFloat" -> return (value as UShort).toFloat()
            "toInt" -> return (value as UShort).toInt()
            "toLong" -> return (value as UShort).toLong()
            "toShort" -> return (value as UShort).toShort()
            "toString" -> return (value as UShort).toString()
            "toUByte" -> return (value as UShort).toUByte()
            "toUInt" -> return (value as UShort).toUInt()
            "toULong" -> return (value as UShort).toULong()
            "toUShort" -> return (value as UShort).toUShort()
        }
        else -> {}
    }
    return null
}