mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-22 15:51:33 +00:00
Add methods for message and clause from Throwable in ir builtins map
This commit is contained in:
@@ -16,13 +16,21 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.common.interpreter.builtins
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.interpreter.stack.State
|
||||
import org.jetbrains.kotlin.backend.common.interpreter.stack.*
|
||||
|
||||
/** This file is generated by org.jetbrains.kotlin.backend.common.interpreter.builtins.GenerateBuiltInsMap.generateMap(). DO NOT MODIFY MANUALLY */
|
||||
|
||||
val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
unaryOperation<Boolean>("not", "Boolean") { a -> a.not() },
|
||||
unaryOperation<Boolean>("toString", "Boolean") { a -> a.toString() },
|
||||
unaryOperation<Char>("toByte", "Char") { a -> a.toByte() },
|
||||
unaryOperation<Char>("toChar", "Char") { a -> a.toChar() },
|
||||
unaryOperation<Char>("toDouble", "Char") { a -> a.toDouble() },
|
||||
unaryOperation<Char>("toFloat", "Char") { a -> a.toFloat() },
|
||||
unaryOperation<Char>("toInt", "Char") { a -> a.toInt() },
|
||||
unaryOperation<Char>("toLong", "Char") { a -> a.toLong() },
|
||||
unaryOperation<Char>("toShort", "Char") { a -> a.toShort() },
|
||||
unaryOperation<Char>("toString", "Char") { a -> a.toString() },
|
||||
unaryOperation<Byte>("toByte", "Byte") { a -> a.toByte() },
|
||||
unaryOperation<Byte>("toChar", "Byte") { a -> a.toChar() },
|
||||
unaryOperation<Byte>("toDouble", "Byte") { a -> a.toDouble() },
|
||||
@@ -33,34 +41,16 @@ val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
unaryOperation<Byte>("toString", "Byte") { a -> a.toString() },
|
||||
unaryOperation<Byte>("unaryMinus", "Byte") { a -> a.unaryMinus() },
|
||||
unaryOperation<Byte>("unaryPlus", "Byte") { a -> a.unaryPlus() },
|
||||
unaryOperation<Char>("toByte", "Char") { a -> a.toByte() },
|
||||
unaryOperation<Char>("toChar", "Char") { a -> a.toChar() },
|
||||
unaryOperation<Char>("toDouble", "Char") { a -> a.toDouble() },
|
||||
unaryOperation<Char>("toFloat", "Char") { a -> a.toFloat() },
|
||||
unaryOperation<Char>("toInt", "Char") { a -> a.toInt() },
|
||||
unaryOperation<Char>("toLong", "Char") { a -> a.toLong() },
|
||||
unaryOperation<Char>("toShort", "Char") { a -> a.toShort() },
|
||||
unaryOperation<Char>("toString", "Char") { a -> a.toString() },
|
||||
unaryOperation<Double>("toByte", "Double") { a -> a.toByte() },
|
||||
unaryOperation<Double>("toChar", "Double") { a -> a.toChar() },
|
||||
unaryOperation<Double>("toDouble", "Double") { a -> a.toDouble() },
|
||||
unaryOperation<Double>("toFloat", "Double") { a -> a.toFloat() },
|
||||
unaryOperation<Double>("toInt", "Double") { a -> a.toInt() },
|
||||
unaryOperation<Double>("toLong", "Double") { a -> a.toLong() },
|
||||
unaryOperation<Double>("toShort", "Double") { a -> a.toShort() },
|
||||
unaryOperation<Double>("toString", "Double") { a -> a.toString() },
|
||||
unaryOperation<Double>("unaryMinus", "Double") { a -> a.unaryMinus() },
|
||||
unaryOperation<Double>("unaryPlus", "Double") { a -> a.unaryPlus() },
|
||||
unaryOperation<Float>("toByte", "Float") { a -> a.toByte() },
|
||||
unaryOperation<Float>("toChar", "Float") { a -> a.toChar() },
|
||||
unaryOperation<Float>("toDouble", "Float") { a -> a.toDouble() },
|
||||
unaryOperation<Float>("toFloat", "Float") { a -> a.toFloat() },
|
||||
unaryOperation<Float>("toInt", "Float") { a -> a.toInt() },
|
||||
unaryOperation<Float>("toLong", "Float") { a -> a.toLong() },
|
||||
unaryOperation<Float>("toShort", "Float") { a -> a.toShort() },
|
||||
unaryOperation<Float>("toString", "Float") { a -> a.toString() },
|
||||
unaryOperation<Float>("unaryMinus", "Float") { a -> a.unaryMinus() },
|
||||
unaryOperation<Float>("unaryPlus", "Float") { a -> a.unaryPlus() },
|
||||
unaryOperation<Short>("toByte", "Short") { a -> a.toByte() },
|
||||
unaryOperation<Short>("toChar", "Short") { a -> a.toChar() },
|
||||
unaryOperation<Short>("toDouble", "Short") { a -> a.toDouble() },
|
||||
unaryOperation<Short>("toFloat", "Short") { a -> a.toFloat() },
|
||||
unaryOperation<Short>("toInt", "Short") { a -> a.toInt() },
|
||||
unaryOperation<Short>("toLong", "Short") { a -> a.toLong() },
|
||||
unaryOperation<Short>("toShort", "Short") { a -> a.toShort() },
|
||||
unaryOperation<Short>("toString", "Short") { a -> a.toString() },
|
||||
unaryOperation<Short>("unaryMinus", "Short") { a -> a.unaryMinus() },
|
||||
unaryOperation<Short>("unaryPlus", "Short") { a -> a.unaryPlus() },
|
||||
unaryOperation<Int>("inv", "Int") { a -> a.inv() },
|
||||
unaryOperation<Int>("toByte", "Int") { a -> a.toByte() },
|
||||
unaryOperation<Int>("toChar", "Int") { a -> a.toChar() },
|
||||
@@ -72,6 +62,16 @@ val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
unaryOperation<Int>("toString", "Int") { a -> a.toString() },
|
||||
unaryOperation<Int>("unaryMinus", "Int") { a -> a.unaryMinus() },
|
||||
unaryOperation<Int>("unaryPlus", "Int") { a -> a.unaryPlus() },
|
||||
unaryOperation<Float>("toByte", "Float") { a -> a.toByte() },
|
||||
unaryOperation<Float>("toChar", "Float") { a -> a.toChar() },
|
||||
unaryOperation<Float>("toDouble", "Float") { a -> a.toDouble() },
|
||||
unaryOperation<Float>("toFloat", "Float") { a -> a.toFloat() },
|
||||
unaryOperation<Float>("toInt", "Float") { a -> a.toInt() },
|
||||
unaryOperation<Float>("toLong", "Float") { a -> a.toLong() },
|
||||
unaryOperation<Float>("toShort", "Float") { a -> a.toShort() },
|
||||
unaryOperation<Float>("toString", "Float") { a -> a.toString() },
|
||||
unaryOperation<Float>("unaryMinus", "Float") { a -> a.unaryMinus() },
|
||||
unaryOperation<Float>("unaryPlus", "Float") { a -> a.unaryPlus() },
|
||||
unaryOperation<Long>("inv", "Long") { a -> a.inv() },
|
||||
unaryOperation<Long>("toByte", "Long") { a -> a.toByte() },
|
||||
unaryOperation<Long>("toChar", "Long") { a -> a.toChar() },
|
||||
@@ -83,20 +83,18 @@ val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
unaryOperation<Long>("toString", "Long") { a -> a.toString() },
|
||||
unaryOperation<Long>("unaryMinus", "Long") { a -> a.unaryMinus() },
|
||||
unaryOperation<Long>("unaryPlus", "Long") { a -> a.unaryPlus() },
|
||||
unaryOperation<Short>("toByte", "Short") { a -> a.toByte() },
|
||||
unaryOperation<Short>("toChar", "Short") { a -> a.toChar() },
|
||||
unaryOperation<Short>("toDouble", "Short") { a -> a.toDouble() },
|
||||
unaryOperation<Short>("toFloat", "Short") { a -> a.toFloat() },
|
||||
unaryOperation<Short>("toInt", "Short") { a -> a.toInt() },
|
||||
unaryOperation<Short>("toLong", "Short") { a -> a.toLong() },
|
||||
unaryOperation<Short>("toShort", "Short") { a -> a.toShort() },
|
||||
unaryOperation<Short>("toString", "Short") { a -> a.toString() },
|
||||
unaryOperation<Short>("unaryMinus", "Short") { a -> a.unaryMinus() },
|
||||
unaryOperation<Short>("unaryPlus", "Short") { a -> a.unaryPlus() },
|
||||
unaryOperation<Double>("toByte", "Double") { a -> a.toByte() },
|
||||
unaryOperation<Double>("toChar", "Double") { a -> a.toChar() },
|
||||
unaryOperation<Double>("toDouble", "Double") { a -> a.toDouble() },
|
||||
unaryOperation<Double>("toFloat", "Double") { a -> a.toFloat() },
|
||||
unaryOperation<Double>("toInt", "Double") { a -> a.toInt() },
|
||||
unaryOperation<Double>("toLong", "Double") { a -> a.toLong() },
|
||||
unaryOperation<Double>("toShort", "Double") { a -> a.toShort() },
|
||||
unaryOperation<Double>("toString", "Double") { a -> a.toString() },
|
||||
unaryOperation<Double>("unaryMinus", "Double") { a -> a.unaryMinus() },
|
||||
unaryOperation<Double>("unaryPlus", "Double") { a -> a.unaryPlus() },
|
||||
unaryOperation<String>("length", "String") { a -> a.length },
|
||||
unaryOperation<String>("toString", "String") { a -> a.toString() },
|
||||
unaryOperation<Array<Any?>>("size", "Array<T>") { a -> a.size },
|
||||
unaryOperation<Array<Any?>>("iterator", "Array<T>") { a -> a.iterator() },
|
||||
unaryOperation<BooleanArray>("size", "BooleanArray") { a -> a.size },
|
||||
unaryOperation<BooleanArray>("iterator", "BooleanArray") { a -> a.iterator() },
|
||||
unaryOperation<CharArray>("size", "CharArray") { a -> a.size },
|
||||
@@ -113,11 +111,13 @@ val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
unaryOperation<LongArray>("iterator", "LongArray") { a -> a.iterator() },
|
||||
unaryOperation<DoubleArray>("size", "DoubleArray") { a -> a.size },
|
||||
unaryOperation<DoubleArray>("iterator", "DoubleArray") { a -> a.iterator() },
|
||||
unaryOperation<Array<Any?>>("size", "Array<T>") { a -> a.size },
|
||||
unaryOperation<Array<Any?>>("iterator", "Array<T>") { a -> a.iterator() },
|
||||
unaryOperation<Any>("hashCode", "Any") { a -> a.hashCode() },
|
||||
unaryOperation<Any>("toString", "Any") { a ->
|
||||
if (a is State) "${a.irClass.name}@" + System.identityHashCode(a).toString(16).padStart(8) else a.toString()
|
||||
},
|
||||
unaryOperation<Any?>("CHECK_NOT_NULL", "T0?") { a -> a!! }
|
||||
unaryOperation<Any>("toString", "Any") { a -> a.defaultToString() },
|
||||
unaryOperation<Any?>("CHECK_NOT_NULL", "T0?") { a -> a!! },
|
||||
unaryOperation<ExceptionState>("<get-message>", "Throwable") { a -> a.getMessage() },
|
||||
unaryOperation<ExceptionState>("<get-cause>", "Throwable") { a -> a.getCause() }
|
||||
)
|
||||
|
||||
val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
@@ -126,6 +126,11 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
binaryOperation<Boolean, Any?>("equals", "Boolean", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Boolean, Boolean>("or", "Boolean", "Boolean") { a, b -> a.or(b) },
|
||||
binaryOperation<Boolean, Boolean>("xor", "Boolean", "Boolean") { a, b -> a.xor(b) },
|
||||
binaryOperation<Char, Char>("compareTo", "Char", "Char") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Char, Any?>("equals", "Char", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Char, Char>("minus", "Char", "Char") { a, b -> a.minus(b) },
|
||||
binaryOperation<Char, Int>("minus", "Char", "Int") { a, b -> a.minus(b) },
|
||||
binaryOperation<Char, Int>("plus", "Char", "Int") { a, b -> a.plus(b) },
|
||||
binaryOperation<Byte, Byte>("compareTo", "Byte", "Byte") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Byte, Double>("compareTo", "Byte", "Double") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Byte, Float>("compareTo", "Byte", "Float") { a, b -> a.compareTo(b) },
|
||||
@@ -167,85 +172,47 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
binaryOperation<Byte, Int>("times", "Byte", "Int") { a, b -> a.times(b) },
|
||||
binaryOperation<Byte, Long>("times", "Byte", "Long") { a, b -> a.times(b) },
|
||||
binaryOperation<Byte, Short>("times", "Byte", "Short") { a, b -> a.times(b) },
|
||||
binaryOperation<Char, Char>("compareTo", "Char", "Char") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Char, Any?>("equals", "Char", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Char, Char>("minus", "Char", "Char") { a, b -> a.minus(b) },
|
||||
binaryOperation<Char, Int>("minus", "Char", "Int") { a, b -> a.minus(b) },
|
||||
binaryOperation<Char, Int>("plus", "Char", "Int") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Byte>("compareTo", "Double", "Byte") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Double, Double>("compareTo", "Double", "Double") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Double, Float>("compareTo", "Double", "Float") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Double, Int>("compareTo", "Double", "Int") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Double, Long>("compareTo", "Double", "Long") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Double, Short>("compareTo", "Double", "Short") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Double, Byte>("div", "Double", "Byte") { a, b -> a.div(b) },
|
||||
binaryOperation<Double, Double>("div", "Double", "Double") { a, b -> a.div(b) },
|
||||
binaryOperation<Double, Float>("div", "Double", "Float") { a, b -> a.div(b) },
|
||||
binaryOperation<Double, Int>("div", "Double", "Int") { a, b -> a.div(b) },
|
||||
binaryOperation<Double, Long>("div", "Double", "Long") { a, b -> a.div(b) },
|
||||
binaryOperation<Double, Short>("div", "Double", "Short") { a, b -> a.div(b) },
|
||||
binaryOperation<Double, Any?>("equals", "Double", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Double, Byte>("minus", "Double", "Byte") { a, b -> a.minus(b) },
|
||||
binaryOperation<Double, Double>("minus", "Double", "Double") { a, b -> a.minus(b) },
|
||||
binaryOperation<Double, Float>("minus", "Double", "Float") { a, b -> a.minus(b) },
|
||||
binaryOperation<Double, Int>("minus", "Double", "Int") { a, b -> a.minus(b) },
|
||||
binaryOperation<Double, Long>("minus", "Double", "Long") { a, b -> a.minus(b) },
|
||||
binaryOperation<Double, Short>("minus", "Double", "Short") { a, b -> a.minus(b) },
|
||||
binaryOperation<Double, Byte>("plus", "Double", "Byte") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Double>("plus", "Double", "Double") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Float>("plus", "Double", "Float") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Int>("plus", "Double", "Int") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Long>("plus", "Double", "Long") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Short>("plus", "Double", "Short") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Byte>("rem", "Double", "Byte") { a, b -> a.rem(b) },
|
||||
binaryOperation<Double, Double>("rem", "Double", "Double") { a, b -> a.rem(b) },
|
||||
binaryOperation<Double, Float>("rem", "Double", "Float") { a, b -> a.rem(b) },
|
||||
binaryOperation<Double, Int>("rem", "Double", "Int") { a, b -> a.rem(b) },
|
||||
binaryOperation<Double, Long>("rem", "Double", "Long") { a, b -> a.rem(b) },
|
||||
binaryOperation<Double, Short>("rem", "Double", "Short") { a, b -> a.rem(b) },
|
||||
binaryOperation<Double, Byte>("times", "Double", "Byte") { a, b -> a.times(b) },
|
||||
binaryOperation<Double, Double>("times", "Double", "Double") { a, b -> a.times(b) },
|
||||
binaryOperation<Double, Float>("times", "Double", "Float") { a, b -> a.times(b) },
|
||||
binaryOperation<Double, Int>("times", "Double", "Int") { a, b -> a.times(b) },
|
||||
binaryOperation<Double, Long>("times", "Double", "Long") { a, b -> a.times(b) },
|
||||
binaryOperation<Double, Short>("times", "Double", "Short") { a, b -> a.times(b) },
|
||||
binaryOperation<Float, Byte>("compareTo", "Float", "Byte") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Float, Double>("compareTo", "Float", "Double") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Float, Float>("compareTo", "Float", "Float") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Float, Int>("compareTo", "Float", "Int") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Float, Long>("compareTo", "Float", "Long") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Float, Short>("compareTo", "Float", "Short") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Float, Byte>("div", "Float", "Byte") { a, b -> a.div(b) },
|
||||
binaryOperation<Float, Double>("div", "Float", "Double") { a, b -> a.div(b) },
|
||||
binaryOperation<Float, Float>("div", "Float", "Float") { a, b -> a.div(b) },
|
||||
binaryOperation<Float, Int>("div", "Float", "Int") { a, b -> a.div(b) },
|
||||
binaryOperation<Float, Long>("div", "Float", "Long") { a, b -> a.div(b) },
|
||||
binaryOperation<Float, Short>("div", "Float", "Short") { a, b -> a.div(b) },
|
||||
binaryOperation<Float, Any?>("equals", "Float", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Float, Byte>("minus", "Float", "Byte") { a, b -> a.minus(b) },
|
||||
binaryOperation<Float, Double>("minus", "Float", "Double") { a, b -> a.minus(b) },
|
||||
binaryOperation<Float, Float>("minus", "Float", "Float") { a, b -> a.minus(b) },
|
||||
binaryOperation<Float, Int>("minus", "Float", "Int") { a, b -> a.minus(b) },
|
||||
binaryOperation<Float, Long>("minus", "Float", "Long") { a, b -> a.minus(b) },
|
||||
binaryOperation<Float, Short>("minus", "Float", "Short") { a, b -> a.minus(b) },
|
||||
binaryOperation<Float, Byte>("plus", "Float", "Byte") { a, b -> a.plus(b) },
|
||||
binaryOperation<Float, Double>("plus", "Float", "Double") { a, b -> a.plus(b) },
|
||||
binaryOperation<Float, Float>("plus", "Float", "Float") { a, b -> a.plus(b) },
|
||||
binaryOperation<Float, Int>("plus", "Float", "Int") { a, b -> a.plus(b) },
|
||||
binaryOperation<Float, Long>("plus", "Float", "Long") { a, b -> a.plus(b) },
|
||||
binaryOperation<Float, Short>("plus", "Float", "Short") { a, b -> a.plus(b) },
|
||||
binaryOperation<Float, Byte>("rem", "Float", "Byte") { a, b -> a.rem(b) },
|
||||
binaryOperation<Float, Double>("rem", "Float", "Double") { a, b -> a.rem(b) },
|
||||
binaryOperation<Float, Float>("rem", "Float", "Float") { a, b -> a.rem(b) },
|
||||
binaryOperation<Float, Int>("rem", "Float", "Int") { a, b -> a.rem(b) },
|
||||
binaryOperation<Float, Long>("rem", "Float", "Long") { a, b -> a.rem(b) },
|
||||
binaryOperation<Float, Short>("rem", "Float", "Short") { a, b -> a.rem(b) },
|
||||
binaryOperation<Float, Byte>("times", "Float", "Byte") { a, b -> a.times(b) },
|
||||
binaryOperation<Float, Double>("times", "Float", "Double") { a, b -> a.times(b) },
|
||||
binaryOperation<Float, Float>("times", "Float", "Float") { a, b -> a.times(b) },
|
||||
binaryOperation<Float, Int>("times", "Float", "Int") { a, b -> a.times(b) },
|
||||
binaryOperation<Float, Long>("times", "Float", "Long") { a, b -> a.times(b) },
|
||||
binaryOperation<Float, Short>("times", "Float", "Short") { a, b -> a.times(b) },
|
||||
binaryOperation<Short, Byte>("compareTo", "Short", "Byte") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Short, Double>("compareTo", "Short", "Double") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Short, Float>("compareTo", "Short", "Float") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Short, Int>("compareTo", "Short", "Int") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Short, Long>("compareTo", "Short", "Long") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Short, Short>("compareTo", "Short", "Short") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Short, Byte>("div", "Short", "Byte") { a, b -> a.div(b) },
|
||||
binaryOperation<Short, Double>("div", "Short", "Double") { a, b -> a.div(b) },
|
||||
binaryOperation<Short, Float>("div", "Short", "Float") { a, b -> a.div(b) },
|
||||
binaryOperation<Short, Int>("div", "Short", "Int") { a, b -> a.div(b) },
|
||||
binaryOperation<Short, Long>("div", "Short", "Long") { a, b -> a.div(b) },
|
||||
binaryOperation<Short, Short>("div", "Short", "Short") { a, b -> a.div(b) },
|
||||
binaryOperation<Short, Any?>("equals", "Short", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Short, Byte>("minus", "Short", "Byte") { a, b -> a.minus(b) },
|
||||
binaryOperation<Short, Double>("minus", "Short", "Double") { a, b -> a.minus(b) },
|
||||
binaryOperation<Short, Float>("minus", "Short", "Float") { a, b -> a.minus(b) },
|
||||
binaryOperation<Short, Int>("minus", "Short", "Int") { a, b -> a.minus(b) },
|
||||
binaryOperation<Short, Long>("minus", "Short", "Long") { a, b -> a.minus(b) },
|
||||
binaryOperation<Short, Short>("minus", "Short", "Short") { a, b -> a.minus(b) },
|
||||
binaryOperation<Short, Byte>("plus", "Short", "Byte") { a, b -> a.plus(b) },
|
||||
binaryOperation<Short, Double>("plus", "Short", "Double") { a, b -> a.plus(b) },
|
||||
binaryOperation<Short, Float>("plus", "Short", "Float") { a, b -> a.plus(b) },
|
||||
binaryOperation<Short, Int>("plus", "Short", "Int") { a, b -> a.plus(b) },
|
||||
binaryOperation<Short, Long>("plus", "Short", "Long") { a, b -> a.plus(b) },
|
||||
binaryOperation<Short, Short>("plus", "Short", "Short") { a, b -> a.plus(b) },
|
||||
binaryOperation<Short, Byte>("rangeTo", "Short", "Byte") { a, b -> a.rangeTo(b) },
|
||||
binaryOperation<Short, Int>("rangeTo", "Short", "Int") { a, b -> a.rangeTo(b) },
|
||||
binaryOperation<Short, Long>("rangeTo", "Short", "Long") { a, b -> a.rangeTo(b) },
|
||||
binaryOperation<Short, Short>("rangeTo", "Short", "Short") { a, b -> a.rangeTo(b) },
|
||||
binaryOperation<Short, Byte>("rem", "Short", "Byte") { a, b -> a.rem(b) },
|
||||
binaryOperation<Short, Double>("rem", "Short", "Double") { a, b -> a.rem(b) },
|
||||
binaryOperation<Short, Float>("rem", "Short", "Float") { a, b -> a.rem(b) },
|
||||
binaryOperation<Short, Int>("rem", "Short", "Int") { a, b -> a.rem(b) },
|
||||
binaryOperation<Short, Long>("rem", "Short", "Long") { a, b -> a.rem(b) },
|
||||
binaryOperation<Short, Short>("rem", "Short", "Short") { a, b -> a.rem(b) },
|
||||
binaryOperation<Short, Byte>("times", "Short", "Byte") { a, b -> a.times(b) },
|
||||
binaryOperation<Short, Double>("times", "Short", "Double") { a, b -> a.times(b) },
|
||||
binaryOperation<Short, Float>("times", "Short", "Float") { a, b -> a.times(b) },
|
||||
binaryOperation<Short, Int>("times", "Short", "Int") { a, b -> a.times(b) },
|
||||
binaryOperation<Short, Long>("times", "Short", "Long") { a, b -> a.times(b) },
|
||||
binaryOperation<Short, Short>("times", "Short", "Short") { a, b -> a.times(b) },
|
||||
binaryOperation<Int, Int>("and", "Int", "Int") { a, b -> a.and(b) },
|
||||
binaryOperation<Int, Byte>("compareTo", "Int", "Byte") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Int, Double>("compareTo", "Int", "Double") { a, b -> a.compareTo(b) },
|
||||
@@ -293,6 +260,43 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
binaryOperation<Int, Short>("times", "Int", "Short") { a, b -> a.times(b) },
|
||||
binaryOperation<Int, Int>("ushr", "Int", "Int") { a, b -> a.ushr(b) },
|
||||
binaryOperation<Int, Int>("xor", "Int", "Int") { a, b -> a.xor(b) },
|
||||
binaryOperation<Float, Byte>("compareTo", "Float", "Byte") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Float, Double>("compareTo", "Float", "Double") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Float, Float>("compareTo", "Float", "Float") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Float, Int>("compareTo", "Float", "Int") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Float, Long>("compareTo", "Float", "Long") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Float, Short>("compareTo", "Float", "Short") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Float, Byte>("div", "Float", "Byte") { a, b -> a.div(b) },
|
||||
binaryOperation<Float, Double>("div", "Float", "Double") { a, b -> a.div(b) },
|
||||
binaryOperation<Float, Float>("div", "Float", "Float") { a, b -> a.div(b) },
|
||||
binaryOperation<Float, Int>("div", "Float", "Int") { a, b -> a.div(b) },
|
||||
binaryOperation<Float, Long>("div", "Float", "Long") { a, b -> a.div(b) },
|
||||
binaryOperation<Float, Short>("div", "Float", "Short") { a, b -> a.div(b) },
|
||||
binaryOperation<Float, Any?>("equals", "Float", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Float, Byte>("minus", "Float", "Byte") { a, b -> a.minus(b) },
|
||||
binaryOperation<Float, Double>("minus", "Float", "Double") { a, b -> a.minus(b) },
|
||||
binaryOperation<Float, Float>("minus", "Float", "Float") { a, b -> a.minus(b) },
|
||||
binaryOperation<Float, Int>("minus", "Float", "Int") { a, b -> a.minus(b) },
|
||||
binaryOperation<Float, Long>("minus", "Float", "Long") { a, b -> a.minus(b) },
|
||||
binaryOperation<Float, Short>("minus", "Float", "Short") { a, b -> a.minus(b) },
|
||||
binaryOperation<Float, Byte>("plus", "Float", "Byte") { a, b -> a.plus(b) },
|
||||
binaryOperation<Float, Double>("plus", "Float", "Double") { a, b -> a.plus(b) },
|
||||
binaryOperation<Float, Float>("plus", "Float", "Float") { a, b -> a.plus(b) },
|
||||
binaryOperation<Float, Int>("plus", "Float", "Int") { a, b -> a.plus(b) },
|
||||
binaryOperation<Float, Long>("plus", "Float", "Long") { a, b -> a.plus(b) },
|
||||
binaryOperation<Float, Short>("plus", "Float", "Short") { a, b -> a.plus(b) },
|
||||
binaryOperation<Float, Byte>("rem", "Float", "Byte") { a, b -> a.rem(b) },
|
||||
binaryOperation<Float, Double>("rem", "Float", "Double") { a, b -> a.rem(b) },
|
||||
binaryOperation<Float, Float>("rem", "Float", "Float") { a, b -> a.rem(b) },
|
||||
binaryOperation<Float, Int>("rem", "Float", "Int") { a, b -> a.rem(b) },
|
||||
binaryOperation<Float, Long>("rem", "Float", "Long") { a, b -> a.rem(b) },
|
||||
binaryOperation<Float, Short>("rem", "Float", "Short") { a, b -> a.rem(b) },
|
||||
binaryOperation<Float, Byte>("times", "Float", "Byte") { a, b -> a.times(b) },
|
||||
binaryOperation<Float, Double>("times", "Float", "Double") { a, b -> a.times(b) },
|
||||
binaryOperation<Float, Float>("times", "Float", "Float") { a, b -> a.times(b) },
|
||||
binaryOperation<Float, Int>("times", "Float", "Int") { a, b -> a.times(b) },
|
||||
binaryOperation<Float, Long>("times", "Float", "Long") { a, b -> a.times(b) },
|
||||
binaryOperation<Float, Short>("times", "Float", "Short") { a, b -> a.times(b) },
|
||||
binaryOperation<Long, Long>("and", "Long", "Long") { a, b -> a.and(b) },
|
||||
binaryOperation<Long, Byte>("compareTo", "Long", "Byte") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Long, Double>("compareTo", "Long", "Double") { a, b -> a.compareTo(b) },
|
||||
@@ -340,52 +344,47 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
binaryOperation<Long, Short>("times", "Long", "Short") { a, b -> a.times(b) },
|
||||
binaryOperation<Long, Int>("ushr", "Long", "Int") { a, b -> a.ushr(b) },
|
||||
binaryOperation<Long, Long>("xor", "Long", "Long") { a, b -> a.xor(b) },
|
||||
binaryOperation<Short, Byte>("compareTo", "Short", "Byte") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Short, Double>("compareTo", "Short", "Double") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Short, Float>("compareTo", "Short", "Float") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Short, Int>("compareTo", "Short", "Int") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Short, Long>("compareTo", "Short", "Long") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Short, Short>("compareTo", "Short", "Short") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Short, Byte>("div", "Short", "Byte") { a, b -> a.div(b) },
|
||||
binaryOperation<Short, Double>("div", "Short", "Double") { a, b -> a.div(b) },
|
||||
binaryOperation<Short, Float>("div", "Short", "Float") { a, b -> a.div(b) },
|
||||
binaryOperation<Short, Int>("div", "Short", "Int") { a, b -> a.div(b) },
|
||||
binaryOperation<Short, Long>("div", "Short", "Long") { a, b -> a.div(b) },
|
||||
binaryOperation<Short, Short>("div", "Short", "Short") { a, b -> a.div(b) },
|
||||
binaryOperation<Short, Any?>("equals", "Short", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Short, Byte>("minus", "Short", "Byte") { a, b -> a.minus(b) },
|
||||
binaryOperation<Short, Double>("minus", "Short", "Double") { a, b -> a.minus(b) },
|
||||
binaryOperation<Short, Float>("minus", "Short", "Float") { a, b -> a.minus(b) },
|
||||
binaryOperation<Short, Int>("minus", "Short", "Int") { a, b -> a.minus(b) },
|
||||
binaryOperation<Short, Long>("minus", "Short", "Long") { a, b -> a.minus(b) },
|
||||
binaryOperation<Short, Short>("minus", "Short", "Short") { a, b -> a.minus(b) },
|
||||
binaryOperation<Short, Byte>("plus", "Short", "Byte") { a, b -> a.plus(b) },
|
||||
binaryOperation<Short, Double>("plus", "Short", "Double") { a, b -> a.plus(b) },
|
||||
binaryOperation<Short, Float>("plus", "Short", "Float") { a, b -> a.plus(b) },
|
||||
binaryOperation<Short, Int>("plus", "Short", "Int") { a, b -> a.plus(b) },
|
||||
binaryOperation<Short, Long>("plus", "Short", "Long") { a, b -> a.plus(b) },
|
||||
binaryOperation<Short, Short>("plus", "Short", "Short") { a, b -> a.plus(b) },
|
||||
binaryOperation<Short, Byte>("rangeTo", "Short", "Byte") { a, b -> a.rangeTo(b) },
|
||||
binaryOperation<Short, Int>("rangeTo", "Short", "Int") { a, b -> a.rangeTo(b) },
|
||||
binaryOperation<Short, Long>("rangeTo", "Short", "Long") { a, b -> a.rangeTo(b) },
|
||||
binaryOperation<Short, Short>("rangeTo", "Short", "Short") { a, b -> a.rangeTo(b) },
|
||||
binaryOperation<Short, Byte>("rem", "Short", "Byte") { a, b -> a.rem(b) },
|
||||
binaryOperation<Short, Double>("rem", "Short", "Double") { a, b -> a.rem(b) },
|
||||
binaryOperation<Short, Float>("rem", "Short", "Float") { a, b -> a.rem(b) },
|
||||
binaryOperation<Short, Int>("rem", "Short", "Int") { a, b -> a.rem(b) },
|
||||
binaryOperation<Short, Long>("rem", "Short", "Long") { a, b -> a.rem(b) },
|
||||
binaryOperation<Short, Short>("rem", "Short", "Short") { a, b -> a.rem(b) },
|
||||
binaryOperation<Short, Byte>("times", "Short", "Byte") { a, b -> a.times(b) },
|
||||
binaryOperation<Short, Double>("times", "Short", "Double") { a, b -> a.times(b) },
|
||||
binaryOperation<Short, Float>("times", "Short", "Float") { a, b -> a.times(b) },
|
||||
binaryOperation<Short, Int>("times", "Short", "Int") { a, b -> a.times(b) },
|
||||
binaryOperation<Short, Long>("times", "Short", "Long") { a, b -> a.times(b) },
|
||||
binaryOperation<Short, Short>("times", "Short", "Short") { a, b -> a.times(b) },
|
||||
binaryOperation<Double, Byte>("compareTo", "Double", "Byte") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Double, Double>("compareTo", "Double", "Double") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Double, Float>("compareTo", "Double", "Float") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Double, Int>("compareTo", "Double", "Int") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Double, Long>("compareTo", "Double", "Long") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Double, Short>("compareTo", "Double", "Short") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<Double, Byte>("div", "Double", "Byte") { a, b -> a.div(b) },
|
||||
binaryOperation<Double, Double>("div", "Double", "Double") { a, b -> a.div(b) },
|
||||
binaryOperation<Double, Float>("div", "Double", "Float") { a, b -> a.div(b) },
|
||||
binaryOperation<Double, Int>("div", "Double", "Int") { a, b -> a.div(b) },
|
||||
binaryOperation<Double, Long>("div", "Double", "Long") { a, b -> a.div(b) },
|
||||
binaryOperation<Double, Short>("div", "Double", "Short") { a, b -> a.div(b) },
|
||||
binaryOperation<Double, Any?>("equals", "Double", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Double, Byte>("minus", "Double", "Byte") { a, b -> a.minus(b) },
|
||||
binaryOperation<Double, Double>("minus", "Double", "Double") { a, b -> a.minus(b) },
|
||||
binaryOperation<Double, Float>("minus", "Double", "Float") { a, b -> a.minus(b) },
|
||||
binaryOperation<Double, Int>("minus", "Double", "Int") { a, b -> a.minus(b) },
|
||||
binaryOperation<Double, Long>("minus", "Double", "Long") { a, b -> a.minus(b) },
|
||||
binaryOperation<Double, Short>("minus", "Double", "Short") { a, b -> a.minus(b) },
|
||||
binaryOperation<Double, Byte>("plus", "Double", "Byte") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Double>("plus", "Double", "Double") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Float>("plus", "Double", "Float") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Int>("plus", "Double", "Int") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Long>("plus", "Double", "Long") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Short>("plus", "Double", "Short") { a, b -> a.plus(b) },
|
||||
binaryOperation<Double, Byte>("rem", "Double", "Byte") { a, b -> a.rem(b) },
|
||||
binaryOperation<Double, Double>("rem", "Double", "Double") { a, b -> a.rem(b) },
|
||||
binaryOperation<Double, Float>("rem", "Double", "Float") { a, b -> a.rem(b) },
|
||||
binaryOperation<Double, Int>("rem", "Double", "Int") { a, b -> a.rem(b) },
|
||||
binaryOperation<Double, Long>("rem", "Double", "Long") { a, b -> a.rem(b) },
|
||||
binaryOperation<Double, Short>("rem", "Double", "Short") { a, b -> a.rem(b) },
|
||||
binaryOperation<Double, Byte>("times", "Double", "Byte") { a, b -> a.times(b) },
|
||||
binaryOperation<Double, Double>("times", "Double", "Double") { a, b -> a.times(b) },
|
||||
binaryOperation<Double, Float>("times", "Double", "Float") { a, b -> a.times(b) },
|
||||
binaryOperation<Double, Int>("times", "Double", "Int") { a, b -> a.times(b) },
|
||||
binaryOperation<Double, Long>("times", "Double", "Long") { a, b -> a.times(b) },
|
||||
binaryOperation<Double, Short>("times", "Double", "Short") { a, b -> a.times(b) },
|
||||
binaryOperation<String, String>("compareTo", "String", "String") { a, b -> a.compareTo(b) },
|
||||
binaryOperation<String, Any?>("equals", "String", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<String, Int>("get", "String", "Int") { a, b -> a.get(b) },
|
||||
binaryOperation<String, Any?>("plus", "String", "Any?") { a, b -> a.plus(b) },
|
||||
binaryOperation<Array<Any?>, Int>("get", "Array<T>", "Int") { a, b -> a.get(b) },
|
||||
binaryOperation<BooleanArray, Int>("get", "BooleanArray", "Int") { a, b -> a.get(b) },
|
||||
binaryOperation<CharArray, Int>("get", "CharArray", "Int") { a, b -> a.get(b) },
|
||||
binaryOperation<ByteArray, Int>("get", "ByteArray", "Int") { a, b -> a.get(b) },
|
||||
@@ -394,6 +393,7 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
binaryOperation<FloatArray, Int>("get", "FloatArray", "Int") { a, b -> a.get(b) },
|
||||
binaryOperation<LongArray, Int>("get", "LongArray", "Int") { a, b -> a.get(b) },
|
||||
binaryOperation<DoubleArray, Int>("get", "DoubleArray", "Int") { a, b -> a.get(b) },
|
||||
binaryOperation<Array<Any?>, Int>("get", "Array<T>", "Int") { a, b -> a.get(b) },
|
||||
binaryOperation<Any, Any?>("equals", "Any", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Char, Char>("less", "Char", "Char") { a, b -> a < b },
|
||||
binaryOperation<Byte, Byte>("less", "Byte", "Byte") { a, b -> a < b },
|
||||
@@ -430,9 +430,9 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
binaryOperation<Boolean, Boolean>("ANDAND", "Boolean", "Boolean") { a, b -> a && b },
|
||||
binaryOperation<Boolean, Boolean>("OROR", "Boolean", "Boolean") { a, b -> a || b }
|
||||
)
|
||||
|
||||
val ternaryFunctions = mapOf<CompileTimeFunction, Function3<Any?, Any?, Any?, Any?>>(
|
||||
ternaryOperation<String, Int, Int>("subSequence", "String", "Int", "Int") { a, b, c -> a.subSequence(b, c) },
|
||||
ternaryOperation<Array<Any?>, Int, Any?>("set", "Array<T>", "Int", "T") { a, b, c -> a.set(b, c) },
|
||||
ternaryOperation<BooleanArray, Int, Boolean>("set", "BooleanArray", "Int", "Boolean") { a, b, c -> a.set(b, c) },
|
||||
ternaryOperation<CharArray, Int, Char>("set", "CharArray", "Int", "Char") { a, b, c -> a.set(b, c) },
|
||||
ternaryOperation<ByteArray, Int, Byte>("set", "ByteArray", "Int", "Byte") { a, b, c -> a.set(b, c) },
|
||||
@@ -440,6 +440,14 @@ val ternaryFunctions = mapOf<CompileTimeFunction, Function3<Any?, Any?, Any?, An
|
||||
ternaryOperation<IntArray, Int, Int>("set", "IntArray", "Int", "Int") { a, b, c -> a.set(b, c) },
|
||||
ternaryOperation<FloatArray, Int, Float>("set", "FloatArray", "Int", "Float") { a, b, c -> a.set(b, c) },
|
||||
ternaryOperation<LongArray, Int, Long>("set", "LongArray", "Int", "Long") { a, b, c -> a.set(b, c) },
|
||||
ternaryOperation<DoubleArray, Int, Double>("set", "DoubleArray", "Int", "Double") { a, b, c -> a.set(b, c) }
|
||||
ternaryOperation<DoubleArray, Int, Double>("set", "DoubleArray", "Int", "Double") { a, b, c -> a.set(b, c) },
|
||||
ternaryOperation<Array<Any?>, Int, Any?>("set", "Array<T>", "Int", "T") { a, b, c -> a.set(b, c) }
|
||||
)
|
||||
|
||||
private fun Any.defaultToString(): String {
|
||||
return when (this) {
|
||||
is State -> "${this.irClass.name}@" + System.identityHashCode(this).toString(16).padStart(8, '0')
|
||||
else -> this.toString().replaceAfter("@", System.identityHashCode(this).toString(16).padStart(8, '0'))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ fun generateMap(): String {
|
||||
p.println(File("license/COPYRIGHT.txt").readText())
|
||||
p.println("package org.jetbrains.kotlin.backend.common.interpreter.builtins")
|
||||
p.println()
|
||||
p.println("import org.jetbrains.kotlin.backend.common.interpreter.stack.State")
|
||||
p.println("import org.jetbrains.kotlin.backend.common.interpreter.stack.*")
|
||||
p.println()
|
||||
p.println("/** This file is generated by org.jetbrains.kotlin.backend.common.interpreter.builtins.GenerateBuiltInsMap.generateMap(). DO NOT MODIFY MANUALLY */")
|
||||
p.println()
|
||||
@@ -52,11 +52,8 @@ fun generateMap(): String {
|
||||
val builtIns = DefaultBuiltIns.Instance
|
||||
|
||||
//save common builtins
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val allPrimitiveTypes = builtIns.builtInsPackageScope.getContributedDescriptors()
|
||||
.filter { it is ClassDescriptor && KotlinBuiltIns.isPrimitiveType(it.defaultType) } as List<ClassDescriptor>
|
||||
|
||||
val arrays = listOf(builtIns.array) + PrimitiveType.values().map { builtIns.getPrimitiveArrayClassDescriptor(it) }
|
||||
val allPrimitiveTypes = PrimitiveType.values().map { builtIns.getBuiltInClassByFqName(it.typeFqName) }
|
||||
val arrays = PrimitiveType.values().map { builtIns.getPrimitiveArrayClassDescriptor(it) } + builtIns.array
|
||||
|
||||
for (descriptor in allPrimitiveTypes + builtIns.string + arrays + builtIns.any) {
|
||||
val typeParameters = descriptor.typeConstructor.parameters.map { it.name.asString() }
|
||||
@@ -118,12 +115,13 @@ fun generateMap(): String {
|
||||
val unaryBody = unaryOperationsMap.entries.joinToString(",\n", postfix = ",\n") { (function, parameters) ->
|
||||
val methodName = "${function.name}"
|
||||
val parentheses = if (function is FunctionDescriptor) "()" else ""
|
||||
val body = if (methodName == "toString" && parameters.first == "<Any>")
|
||||
"\n\t\tif (a is State) \"\${a.irClass.name}@\" + System.identityHashCode(a).toString(16).padStart(8) else a.toString()\n\t"
|
||||
else
|
||||
"a.$methodName$parentheses "
|
||||
" unaryOperation${parameters.first}(\"$methodName\", ${parameters.second}) { a -> $body}"
|
||||
} + " unaryOperation<Any?>(\"${irNullCheck.name}\", \"${irNullCheck.valueParameters.first().type}\") { a -> a!! }"
|
||||
val body =
|
||||
if (methodName == "toString" && parameters.first == "<Any>") "a.defaultToString()"
|
||||
else "a.$methodName$parentheses"
|
||||
" unaryOperation${parameters.first}(\"$methodName\", ${parameters.second}) { a -> $body }"
|
||||
} + " unaryOperation<Any?>(\"${irNullCheck.name}\", \"${irNullCheck.valueParameters.first().type}\") { a -> a!! },\n" +
|
||||
" unaryOperation<ExceptionState>(\"<get-message>\", \"Throwable\") { a -> a.getMessage() },\n" +
|
||||
" unaryOperation<ExceptionState>(\"<get-cause>\", \"Throwable\") { a -> a.getCause() }"
|
||||
p.println(unaryBody)
|
||||
p.println(")")
|
||||
p.println()
|
||||
@@ -150,6 +148,7 @@ fun generateMap(): String {
|
||||
}
|
||||
p.println(binaryBody)
|
||||
p.println(")")
|
||||
p.println()
|
||||
|
||||
p.println("val ternaryFunctions = mapOf<CompileTimeFunction, Function3<Any?, Any?, Any?, Any?>>(")
|
||||
val ternaryBody = ternaryOperationsMap.entries.joinToString(",\n") { (function, parameters) ->
|
||||
@@ -160,6 +159,18 @@ fun generateMap(): String {
|
||||
p.println(")")
|
||||
p.println()
|
||||
|
||||
p.println(
|
||||
"""
|
||||
private fun Any.defaultToString(): String {
|
||||
return when (this) {
|
||||
is State -> "${'$'}{this.irClass.name}@" + System.identityHashCode(this).toString(16).padStart(8, '0')
|
||||
else -> this.toString().replaceAfter("@", System.identityHashCode(this).toString(16).padStart(8, '0'))
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
)
|
||||
p.println()
|
||||
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user