Add new bitwise operations to constant evaluator map. #KT-13554
This commit is contained in:
+8
@@ -28,6 +28,7 @@ internal val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
||||
= hashMapOf<UnaryOperationKey<*>, Pair<Function1<Any?, Any>, Function1<Long, Long>>>(
|
||||
unaryOperation(BOOLEAN, "not", { a -> a.not() }, emptyUnaryFun),
|
||||
unaryOperation(BOOLEAN, "toString", { a -> a.toString() }, emptyUnaryFun),
|
||||
unaryOperation(BYTE, "inv", { a -> a.inv() }, emptyUnaryFun),
|
||||
unaryOperation(BYTE, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
||||
unaryOperation(BYTE, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||
unaryOperation(BYTE, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
|
||||
@@ -88,6 +89,7 @@ internal val unaryOperations: HashMap<UnaryOperationKey<*>, Pair<Function1<Any?,
|
||||
unaryOperation(LONG, "toString", { a -> a.toString() }, emptyUnaryFun),
|
||||
unaryOperation(LONG, "unaryMinus", { a -> a.unaryMinus() }, { a -> a.unaryMinus() }),
|
||||
unaryOperation(LONG, "unaryPlus", { a -> a.unaryPlus() }, emptyUnaryFun),
|
||||
unaryOperation(SHORT, "inv", { a -> a.inv() }, emptyUnaryFun),
|
||||
unaryOperation(SHORT, "toByte", { a -> a.toByte() }, emptyUnaryFun),
|
||||
unaryOperation(SHORT, "toChar", { a -> a.toChar() }, emptyUnaryFun),
|
||||
unaryOperation(SHORT, "toDouble", { a -> a.toDouble() }, emptyUnaryFun),
|
||||
@@ -109,6 +111,7 @@ internal val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<
|
||||
binaryOperation(BOOLEAN, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun),
|
||||
binaryOperation(BOOLEAN, BOOLEAN, "or", { a, b -> a.or(b) }, emptyBinaryFun),
|
||||
binaryOperation(BOOLEAN, BOOLEAN, "xor", { a, b -> a.xor(b) }, emptyBinaryFun),
|
||||
binaryOperation(BYTE, BYTE, "and", { a, b -> a.and(b) }, { a, b -> a.and(b) }),
|
||||
binaryOperation(BYTE, BYTE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun),
|
||||
binaryOperation(BYTE, DOUBLE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun),
|
||||
binaryOperation(BYTE, FLOAT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun),
|
||||
@@ -134,6 +137,7 @@ internal val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<
|
||||
binaryOperation(BYTE, INT, "mod", { a, b -> a.mod(b) }, { a, b -> a.mod(b) }),
|
||||
binaryOperation(BYTE, LONG, "mod", { a, b -> a.mod(b) }, { a, b -> a.mod(b) }),
|
||||
binaryOperation(BYTE, SHORT, "mod", { a, b -> a.mod(b) }, { a, b -> a.mod(b) }),
|
||||
binaryOperation(BYTE, BYTE, "or", { a, b -> a.or(b) }, { a, b -> a.or(b) }),
|
||||
binaryOperation(BYTE, BYTE, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }),
|
||||
binaryOperation(BYTE, DOUBLE, "plus", { a, b -> a.plus(b) }, emptyBinaryFun),
|
||||
binaryOperation(BYTE, FLOAT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun),
|
||||
@@ -146,6 +150,7 @@ internal val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<
|
||||
binaryOperation(BYTE, INT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }),
|
||||
binaryOperation(BYTE, LONG, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }),
|
||||
binaryOperation(BYTE, SHORT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }),
|
||||
binaryOperation(BYTE, BYTE, "xor", { a, b -> a.xor(b) }, { a, b -> a.xor(b) }),
|
||||
binaryOperation(CHAR, CHAR, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun),
|
||||
binaryOperation(CHAR, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun),
|
||||
binaryOperation(CHAR, CHAR, "minus", { a, b -> a.minus(b) }, emptyBinaryFun),
|
||||
@@ -311,6 +316,7 @@ internal val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<
|
||||
binaryOperation(LONG, SHORT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }),
|
||||
binaryOperation(LONG, INT, "ushr", { a, b -> a.ushr(b) }, emptyBinaryFun),
|
||||
binaryOperation(LONG, LONG, "xor", { a, b -> a.xor(b) }, { a, b -> a.xor(b) }),
|
||||
binaryOperation(SHORT, SHORT, "and", { a, b -> a.and(b) }, { a, b -> a.and(b) }),
|
||||
binaryOperation(SHORT, BYTE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun),
|
||||
binaryOperation(SHORT, DOUBLE, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun),
|
||||
binaryOperation(SHORT, FLOAT, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun),
|
||||
@@ -336,6 +342,7 @@ internal val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<
|
||||
binaryOperation(SHORT, INT, "mod", { a, b -> a.mod(b) }, { a, b -> a.mod(b) }),
|
||||
binaryOperation(SHORT, LONG, "mod", { a, b -> a.mod(b) }, { a, b -> a.mod(b) }),
|
||||
binaryOperation(SHORT, SHORT, "mod", { a, b -> a.mod(b) }, { a, b -> a.mod(b) }),
|
||||
binaryOperation(SHORT, SHORT, "or", { a, b -> a.or(b) }, { a, b -> a.or(b) }),
|
||||
binaryOperation(SHORT, BYTE, "plus", { a, b -> a.plus(b) }, { a, b -> a.add(b) }),
|
||||
binaryOperation(SHORT, DOUBLE, "plus", { a, b -> a.plus(b) }, emptyBinaryFun),
|
||||
binaryOperation(SHORT, FLOAT, "plus", { a, b -> a.plus(b) }, emptyBinaryFun),
|
||||
@@ -348,6 +355,7 @@ internal val binaryOperations: HashMap<BinaryOperationKey<*, *>, Pair<Function2<
|
||||
binaryOperation(SHORT, INT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }),
|
||||
binaryOperation(SHORT, LONG, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }),
|
||||
binaryOperation(SHORT, SHORT, "times", { a, b -> a.times(b) }, { a, b -> a.multiply(b) }),
|
||||
binaryOperation(SHORT, SHORT, "xor", { a, b -> a.xor(b) }, { a, b -> a.xor(b) }),
|
||||
binaryOperation(STRING, STRING, "compareTo", { a, b -> a.compareTo(b) }, emptyBinaryFun),
|
||||
binaryOperation(STRING, ANY, "equals", { a, b -> a.equals(b) }, emptyBinaryFun),
|
||||
binaryOperation(STRING, INT, "get", { a, b -> a.get(b) }, emptyBinaryFun),
|
||||
|
||||
Reference in New Issue
Block a user