Add inc, dec methods in ir builtins map and remove toString and equals
This commit is contained in:
+15
-18
@@ -22,7 +22,8 @@ import org.jetbrains.kotlin.backend.common.interpreter.stack.*
|
||||
|
||||
val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
unaryOperation<Boolean>("not", "Boolean") { a -> a.not() },
|
||||
unaryOperation<Boolean>("toString", "Boolean") { a -> a.toString() },
|
||||
unaryOperation<Char>("dec", "Char") { a -> a.dec() },
|
||||
unaryOperation<Char>("inc", "Char") { a -> a.inc() },
|
||||
unaryOperation<Char>("toByte", "Char") { a -> a.toByte() },
|
||||
unaryOperation<Char>("toChar", "Char") { a -> a.toChar() },
|
||||
unaryOperation<Char>("toDouble", "Char") { a -> a.toDouble() },
|
||||
@@ -30,7 +31,8 @@ val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
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>("dec", "Byte") { a -> a.dec() },
|
||||
unaryOperation<Byte>("inc", "Byte") { a -> a.inc() },
|
||||
unaryOperation<Byte>("toByte", "Byte") { a -> a.toByte() },
|
||||
unaryOperation<Byte>("toChar", "Byte") { a -> a.toChar() },
|
||||
unaryOperation<Byte>("toDouble", "Byte") { a -> a.toDouble() },
|
||||
@@ -38,9 +40,10 @@ val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
unaryOperation<Byte>("toInt", "Byte") { a -> a.toInt() },
|
||||
unaryOperation<Byte>("toLong", "Byte") { a -> a.toLong() },
|
||||
unaryOperation<Byte>("toShort", "Byte") { a -> a.toShort() },
|
||||
unaryOperation<Byte>("toString", "Byte") { a -> a.toString() },
|
||||
unaryOperation<Byte>("unaryMinus", "Byte") { a -> a.unaryMinus() },
|
||||
unaryOperation<Byte>("unaryPlus", "Byte") { a -> a.unaryPlus() },
|
||||
unaryOperation<Short>("dec", "Short") { a -> a.dec() },
|
||||
unaryOperation<Short>("inc", "Short") { a -> a.inc() },
|
||||
unaryOperation<Short>("toByte", "Short") { a -> a.toByte() },
|
||||
unaryOperation<Short>("toChar", "Short") { a -> a.toChar() },
|
||||
unaryOperation<Short>("toDouble", "Short") { a -> a.toDouble() },
|
||||
@@ -48,9 +51,10 @@ val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
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>("dec", "Int") { a -> a.dec() },
|
||||
unaryOperation<Int>("inc", "Int") { a -> a.inc() },
|
||||
unaryOperation<Int>("inv", "Int") { a -> a.inv() },
|
||||
unaryOperation<Int>("toByte", "Int") { a -> a.toByte() },
|
||||
unaryOperation<Int>("toChar", "Int") { a -> a.toChar() },
|
||||
@@ -59,9 +63,10 @@ val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
unaryOperation<Int>("toInt", "Int") { a -> a.toInt() },
|
||||
unaryOperation<Int>("toLong", "Int") { a -> a.toLong() },
|
||||
unaryOperation<Int>("toShort", "Int") { a -> a.toShort() },
|
||||
unaryOperation<Int>("toString", "Int") { a -> a.toString() },
|
||||
unaryOperation<Int>("unaryMinus", "Int") { a -> a.unaryMinus() },
|
||||
unaryOperation<Int>("unaryPlus", "Int") { a -> a.unaryPlus() },
|
||||
unaryOperation<Float>("dec", "Float") { a -> a.dec() },
|
||||
unaryOperation<Float>("inc", "Float") { a -> a.inc() },
|
||||
unaryOperation<Float>("toByte", "Float") { a -> a.toByte() },
|
||||
unaryOperation<Float>("toChar", "Float") { a -> a.toChar() },
|
||||
unaryOperation<Float>("toDouble", "Float") { a -> a.toDouble() },
|
||||
@@ -69,9 +74,10 @@ val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
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>("dec", "Long") { a -> a.dec() },
|
||||
unaryOperation<Long>("inc", "Long") { a -> a.inc() },
|
||||
unaryOperation<Long>("inv", "Long") { a -> a.inv() },
|
||||
unaryOperation<Long>("toByte", "Long") { a -> a.toByte() },
|
||||
unaryOperation<Long>("toChar", "Long") { a -> a.toChar() },
|
||||
@@ -80,9 +86,10 @@ val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
unaryOperation<Long>("toInt", "Long") { a -> a.toInt() },
|
||||
unaryOperation<Long>("toLong", "Long") { a -> a.toLong() },
|
||||
unaryOperation<Long>("toShort", "Long") { a -> a.toShort() },
|
||||
unaryOperation<Long>("toString", "Long") { a -> a.toString() },
|
||||
unaryOperation<Long>("unaryMinus", "Long") { a -> a.unaryMinus() },
|
||||
unaryOperation<Long>("unaryPlus", "Long") { a -> a.unaryPlus() },
|
||||
unaryOperation<Double>("dec", "Double") { a -> a.dec() },
|
||||
unaryOperation<Double>("inc", "Double") { a -> a.inc() },
|
||||
unaryOperation<Double>("toByte", "Double") { a -> a.toByte() },
|
||||
unaryOperation<Double>("toChar", "Double") { a -> a.toChar() },
|
||||
unaryOperation<Double>("toDouble", "Double") { a -> a.toDouble() },
|
||||
@@ -90,11 +97,9 @@ val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
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<BooleanArray>("size", "BooleanArray") { a -> a.size },
|
||||
unaryOperation<BooleanArray>("iterator", "BooleanArray") { a -> a.iterator() },
|
||||
unaryOperation<CharArray>("size", "CharArray") { a -> a.size },
|
||||
@@ -123,14 +128,13 @@ val unaryFunctions = mapOf<CompileTimeFunction, Function1<Any?, Any?>>(
|
||||
val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
binaryOperation<Boolean, Boolean>("and", "Boolean", "Boolean") { a, b -> a.and(b) },
|
||||
binaryOperation<Boolean, Boolean>("compareTo", "Boolean", "Boolean") { a, b -> a.compareTo(b) },
|
||||
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<Char, Char>("rangeTo", "Char", "Char") { a, b -> a.rangeTo(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) },
|
||||
@@ -143,7 +147,6 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
binaryOperation<Byte, Int>("div", "Byte", "Int") { a, b -> a.div(b) },
|
||||
binaryOperation<Byte, Long>("div", "Byte", "Long") { a, b -> a.div(b) },
|
||||
binaryOperation<Byte, Short>("div", "Byte", "Short") { a, b -> a.div(b) },
|
||||
binaryOperation<Byte, Any?>("equals", "Byte", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Byte, Byte>("minus", "Byte", "Byte") { a, b -> a.minus(b) },
|
||||
binaryOperation<Byte, Double>("minus", "Byte", "Double") { a, b -> a.minus(b) },
|
||||
binaryOperation<Byte, Float>("minus", "Byte", "Float") { a, b -> a.minus(b) },
|
||||
@@ -184,7 +187,6 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
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) },
|
||||
@@ -226,7 +228,6 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
binaryOperation<Int, Int>("div", "Int", "Int") { a, b -> a.div(b) },
|
||||
binaryOperation<Int, Long>("div", "Int", "Long") { a, b -> a.div(b) },
|
||||
binaryOperation<Int, Short>("div", "Int", "Short") { a, b -> a.div(b) },
|
||||
binaryOperation<Int, Any?>("equals", "Int", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Int, Byte>("minus", "Int", "Byte") { a, b -> a.minus(b) },
|
||||
binaryOperation<Int, Double>("minus", "Int", "Double") { a, b -> a.minus(b) },
|
||||
binaryOperation<Int, Float>("minus", "Int", "Float") { a, b -> a.minus(b) },
|
||||
@@ -272,7 +273,6 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
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) },
|
||||
@@ -310,7 +310,6 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
binaryOperation<Long, Int>("div", "Long", "Int") { a, b -> a.div(b) },
|
||||
binaryOperation<Long, Long>("div", "Long", "Long") { a, b -> a.div(b) },
|
||||
binaryOperation<Long, Short>("div", "Long", "Short") { a, b -> a.div(b) },
|
||||
binaryOperation<Long, Any?>("equals", "Long", "Any?") { a, b -> a.equals(b) },
|
||||
binaryOperation<Long, Byte>("minus", "Long", "Byte") { a, b -> a.minus(b) },
|
||||
binaryOperation<Long, Double>("minus", "Long", "Double") { a, b -> a.minus(b) },
|
||||
binaryOperation<Long, Float>("minus", "Long", "Float") { a, b -> a.minus(b) },
|
||||
@@ -356,7 +355,6 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
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) },
|
||||
@@ -382,7 +380,6 @@ val binaryFunctions = mapOf<CompileTimeFunction, Function2<Any?, Any?, Any?>>(
|
||||
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<BooleanArray, Int>("get", "BooleanArray", "Int") { a, b -> a.get(b) },
|
||||
|
||||
Reference in New Issue
Block a user